package labox.innovation.config;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;

import javolution.util.FastList;
import javolution.util.FastMap;
import labox.innovation.gameserver.util.FloodProtectorConfig;
import labox.innovation.gameserver.util.StringUtil;
import labox.innovation.util.L2Properties;

public final class Config {

	protected static final Logger _log = LoggerFactory.getLogger(Config.class.getName());

	// --------------------------------------------------
	// Innovation Property File Definitions
	// --------------------------------------------------
	public static final String CHARACTER_CONFIG_FILE = "./config/character.properties";

	public static final String EXTENSIONS_CONFIG_FILE = "./config/extensions.properties";

	public static final String FEATURE_CONFIG_FILE = "./config/feature.properties";

	public static final String FORTSIEGE_CONFIGURATION_FILE = "./config/fortsiege.properties";

	public static final String GENERAL_CONFIG_FILE = "./config/general.properties";

	public static final String HEXID_FILE = "./config/hexid.txt";

	public static final String ID_CONFIG_FILE = "./config/idfactory.properties";

	public static final String SERVER_VERSION_FILE = "./config/Inno-version.properties";

	public static final String DATAPACK_VERSION_FILE = "./config/Innodp-version.properties";

	public static final String L2JMOD_CONFIG_FILE = "./config/l2jmods.properties";

	public static final String LOGIN_CONFIGURATION_FILE = "./config/loginserver.properties";

	public static final String NPC_CONFIG_FILE = "./config/npc.properties";

	public static final String PVP_CONFIG_FILE = "./config/pvp.properties";

	public static final String RATES_CONFIG_FILE = "./config/rates.properties";

	public static final String CONFIGURATION_FILE = "./config/server.properties";

	public static final String SIEGE_CONFIGURATION_FILE = "./config/siege.properties";

	public static final String TELNET_FILE = "./config/telnet.properties";

	public static final String FLOOD_PROTECTOR_FILE = "./config/floodprotector.properties";

	public static final String NETCORE_CONFIG_FILE = "./config/netcore.properties";

	public static final String LOG_CONFIG_FILE = "./config/log.properties";

	// --------------------------------------------------
	// L2J Variable Definitions
	// --------------------------------------------------
	/**
	 * 用户的连接权限值127~255，大的权限将可以执行管理员命令
	 */
	public static int MASTERACCESS_LEVEL;

	/**
	 * 相应权限的名字颜色
	 */
	public static int MASTERACCESS_NAME_COLOR;

	/**
	 * 相应权限的头衔的颜色
	 */
	public static int MASTERACCESS_TITLE_COLOR;

	/**
	 * 重生时HP的回复百分比
	 */
	public static float RESPAWN_RESTORE_HP;

	/**
	 * 重生时MP的回复百分比
	 */
	public static float RESPAWN_RESTORE_MP;

	/**
	 * 原地复活的花费
	 */
	public static int RESPAWN_COST;

	/**
	 * 角色所能获得的所有buff
	 */
	public static byte BUFFS_MAX_AMOUNT;

	/**
	 * 是否允许多等级相同的效果替换
	 */
	public static boolean EFFECT_CANCELING;

	/**
	 * 是否允许魔法伤害有失败的情况
	 */
	public static boolean ALT_GAME_MAGICFAILURES;

	/**
	 * 是否保存身上的buff/debuff状态
	 */
	public static boolean STORE_SKILL_COOLTIME;

	/**
	 * 是否允许NPC修改职业，而不需要事件的发生
	 */
	public static boolean ALLOW_CLASS_MASTERS;

	/**
	 * 是否允许NPC修改职业，而无视任何限制
	 */
	public static boolean ALLOW_ENTIRE_TREE;

	/**
	 * 所有的技能都能学习
	 */
	public static boolean ALT_GAME_SKILL_LEARN;

	/**
	 * 角色最大的移动速度
	 */
	public static int MAX_RUN_SPEED;

	/**
	 * 角色最大的暴击率
	 */
	public static int MAX_CRIT_RATE;

	/**
	 * 角色暴击伤害系数
	 */
	public static float CRIT_DMG_RATE;

	/**
	 * 角色最大物理攻击速度
	 */
	public static int MAX_PATK_SPEED;

	/**
	 * 角色最大魔法攻击速度
	 */
	public static int MAX_MATK_SPEED;

	/**
	 * 私人商店贩卖的最大槽位
	 */
	public static int MAX_PVTSTORESELL_SLOTS_OTHER;

	/**
	 * 私人商店购买的最大槽位
	 */
	public static int MAX_PVTSTOREBUY_SLOTS_OTHER;

	/**
	 * 玩家背包的最大空间
	 */
	public static int INVENTORY_MAXIMUM;

	/**
	 * GM背包的最大空间
	 */
	public static int INVENTORY_MAXIMUM_GM;

	/**
	 * 玩家仓库的最大空间
	 */
	public static int WAREHOUSE_SLOTS_NO_DWARF;

	/**
	 * 帮会的仓库的最大空间
	 */
	public static int WAREHOUSE_SLOTS_CLAN;

	/**
	 * 货仓空间
	 */
	public static int FREIGHT_SLOTS;

	/**
	 * 是否在安全区能够PK红名玩家
	 */
	public static boolean ALT_GAME_KARMA_PLAYER_CAN_BE_KILLED_IN_PEACEZONE;

	/**
	 * 是否红名玩家能够使用商店
	 */
	public static boolean ALT_GAME_KARMA_PLAYER_CAN_SHOP;

	/**
	 * 是否红名玩家可以交易
	 */
	public static boolean ALT_GAME_KARMA_PLAYER_CAN_TRADE;

	/**
	 * 是否红名玩家可以使用仓库
	 */
	public static boolean ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE;

	/**
	 * 新手保护等级
	 */
	public static int PK_LEVEL_MIN;

	public static int ALT_CLAN_JOIN_DAYS;

	public static int ALT_CLAN_CREATE_DAYS;

	public static int ALT_CLAN_DISSOLVE_DAYS;

	public static int ALT_ALLY_JOIN_DAYS_WHEN_LEAVED;

	public static int ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED;

	public static int ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED;

	public static int ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED;

	public static int ALT_MAX_NUM_OF_CLANS_IN_ALLY;

	public static int ALT_CLAN_MEMBERS_FOR_WAR;

	public static boolean ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH;

	public static boolean REMOVE_CASTLE_CIRCLETS;

	public static int ALT_PARTY_RANGE;

	public static int ALT_PARTY_RANGE2;

	/**
	 * 初始配置给角色的游戏币
	 */
	public static int STARTING_ADENA;

	public static byte STARTING_LEVEL;

	public static boolean AUTO_LOOT;

	public static boolean AUTO_LOOT_RAIDS;

	public static int UNSTUCK_INTERVAL;

	/**
	 * 玩家出生保护
	 */
	public static int PLAYER_SPAWN_PROTECTION;

	public static boolean RESPAWN_RANDOM_ENABLED;

	public static int RESPAWN_RANDOM_MAX_OFFSET;

	public static boolean RESTORE_PLAYER_INSTANCE;

	public static boolean ALLOW_SUMMON_TO_INSTANCE;

	public static boolean PETITIONING_ALLOWED;

	public static int MAX_PETITIONS_PER_PLAYER;

	public static int MAX_PETITIONS_PENDING;

	public static boolean ALT_GAME_FREIGHTS;

	public static int ALT_GAME_FREIGHT_PRICE;

	public static boolean ALT_GAME_FREE_TELEPORT;

	public static boolean ALT_RECOMMEND;

	/**
	 * 角色被标记删除后，几天后被真正的删除
	 */
	public static int DELETE_DAYS;

	/**
	 * 系统经验系数
	 */
	public static float ALT_GAME_EXPONENT_XP;

	public static String PARTY_XP_CUTOFF_METHOD;

	public static double PARTY_XP_CUTOFF_PERCENT;

	public static int PARTY_XP_CUTOFF_LEVEL;

	// --------------------------------------------------
	// General Settings
	// --------------------------------------------------

	public static int ITEMDROPNUMS;

	/**
	 * 寻路系统最大搜索节点数
	 */
	public static int PATHFINDING_MAX_NODE;

	/**
	 * 角色坐标同步间隔时间（豪秒）
	 */
	public static int SYNC_LOCATION_INTERVAL;

	/**
	 * 游戏服务器在登录服务器上显示的业务类型（0普通服、1新服、2推荐服）
	 */
	public static int SERVER_TYPE;

	public static boolean EVERYBODY_HAS_ADMIN_RIGHTS;

	public static boolean DISPLAY_SERVER_VERSION;

	/**
	 * 是否标记为类别服务器
	 */
	public static boolean SERVER_LIST_BRACKET;

	/**
	 * 是否标记为时限服务器
	 */
	public static boolean SERVER_LIST_CLOCK;

	/**
	 * 是否标记为GM专用服务器
	 */
	public static boolean SERVER_GMONLY;

	public static boolean GM_HERO_AURA;

	public static boolean GM_STARTUP_INVULNERABLE;

	public static boolean GM_STARTUP_INVISIBLE;

	public static boolean GM_STARTUP_SILENCE;

	public static boolean GM_STARTUP_AUTO_LIST;

	public static boolean GM_STARTUP_DIET_MODE;

	public static String GM_ADMIN_MENU_STYLE;

	public static boolean GM_ITEM_RESTRICTION;

	public static boolean GM_SKILL_RESTRICTION;

	public static boolean GM_TRADE_RESTRICTED_ITEMS;

	public static boolean GM_RESTART_FIGHTING;

	public static boolean BYPASS_VALIDATION;

	public static int GAMEGUARD_ENFORCE;

	public static boolean GAMEGUARD_PROHIBITACTION;

	public static boolean LOG_CHAT;

	public static boolean LOG_ITEMS;

	public static boolean LOG_ITEM_ENCHANTS;

	public static boolean LOG_SKILL_ENCHANTS;

	public static boolean GMAUDIT;

	public static boolean LOG_GAME_DAMAGE;

	public static int LOG_GAME_DAMAGE_THRESHOLD;

	/**
	 * 是否在服务器启动的时候缓存所有玩家ID->名称的映射，（可以加快角色名注册的逻辑,会消耗大量内存）
	 */
	public static boolean CACHE_CHAR_NAMES;

	public static String ITEMRANDATTRIBUE;

	/**
	 * 是否启用debug模式
	 */
	public static boolean DEBUG;

	/**
	 * 是否启用数据包处理的debug模式
	 */
	public static boolean PACKET_HANDLER_DEBUG;

	/**
	 * 是否启用断言模式
	 */
	public static boolean ASSERT;

	/**
	 * 是否启用开发模式
	 */
	public static boolean DEVELOPER;

	public static boolean ACCEPT_GEOEDITOR_CONN;

	public static boolean TEST_SERVER;

	public static boolean ALT_DEV_NO_QUESTS;

	/**
	 * 是否标志服务器为测试服务器
	 */
	public static boolean SERVER_LIST_TESTSERVER;

	public static int GENERAL_THREAD_CORE_SIZE;

	public static boolean DEADLOCK_DETECTOR;

	/**
	 * 服务器死锁检测周期（秒）
	 */
	public static int DEADLOCK_CHECK_INTERVAL;

	/**
	 * 死锁线程检测到死锁发生后是否重启服务器
	 */
	public static boolean RESTART_ON_DEADLOCK;

	public static boolean ALLOW_DISCARDITEM;

	public static int AUTODESTROY_ITEM_AFTER;

	public static int HERB_AUTO_DESTROY_TIME;

	public static String PROTECTED_ITEMS;

	public static List<Integer> LIST_PROTECTED_ITEMS = new FastList<Integer>();

	public static int CHAR_STORE_INTERVAL;

	/**
	 * 寄售物品回写时间间隔
	 */
	public static int CONSGNMENT_SAVE_INTERVAL;
	/**
	 * 在线玩家时间间隔
	 */
	public static int AUTO_COUNT_PLAYER_INTERVAL;

	public static boolean LAZY_ITEMS_UPDATE;

	public static boolean UPDATE_ITEMS_ON_CHAR_STORE;

	public static boolean DESTROY_DROPPED_PLAYER_ITEM;

	public static boolean DESTROY_EQUIPABLE_PLAYER_ITEM;

	public static boolean SAVE_DROPPED_ITEM;

	public static boolean EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD;

	public static int SAVE_DROPPED_ITEM_INTERVAL;

	public static boolean CLEAR_DROPPED_ITEM_TABLE;

	public static boolean AUTODELETE_INVALID_QUEST_DATA;

	public static boolean PRECISE_DROP_CALCULATION;

	public static boolean MULTIPLE_ITEM_DROP;

	public static boolean FORCE_INVENTORY_UPDATE;

	public static boolean LAZY_CACHE;

	public static int MIN_NPC_ANIMATION;

	public static int MAX_NPC_ANIMATION;

	public static int MIN_MONSTER_ANIMATION;

	public static int MAX_MONSTER_ANIMATION;

	public static int COORD_SYNCHRONIZE;

	public static boolean GRIDS_ALWAYS_ON;

	public static int GRID_NEIGHBOR_TURNON_TIME;

	public static int GRID_NEIGHBOR_TURNOFF_TIME;

	public static int GEODATA;

	public static boolean GEODATA_CELLFINDING;

	public static boolean FORCE_GEODATA;

	public static boolean MOVE_BASED_KNOWNLIST;

	public static long KNOWNLIST_UPDATE_INTERVAL;

	public static int ZONE_TOWN;

	public static boolean ACTIVATE_POSITION_RECORDER;

	public static String DEFAULT_GLOBAL_CHAT;

	public static String DEFAULT_TRADE_CHAT;

	public static boolean ALLOW_WAREHOUSE;

	public static boolean ALLOW_FREIGHT;

	public static boolean ALLOW_WEAR;

	public static int WEAR_DELAY;

	public static int WEAR_PRICE;

	public static boolean ALLOW_LOTTERY;

	public static boolean ALLOW_RACE;

	public static boolean ALLOW_WATER;

	public static boolean ALLOW_RENTPET;

	public static boolean ALLOWFISHING;

	public static boolean ALLOW_BOAT;

	public static boolean ALLOW_CURSED_WEAPONS;

	public static boolean ALLOW_MANOR;

	public static boolean ALLOW_NPC_WALKERS;

	public static boolean ALLOW_PET_WALKERS;

	public static boolean SERVER_NEWS;

	public static int COMMUNITY_TYPE;

	public static boolean BBS_SHOW_PLAYERLIST;

	public static String BBS_DEFAULT;

	public static boolean SHOW_LEVEL_COMMUNITYBOARD;

	public static boolean SHOW_STATUS_COMMUNITYBOARD;

	public static int NAME_PAGE_SIZE_COMMUNITYBOARD;

	public static int NAME_PER_ROW_COMMUNITYBOARD;

	public static int ALT_OLY_START_TIME;

	public static int ALT_OLY_MIN;

	public static long ALT_OLY_CPERIOD;

	public static long ALT_OLY_BATTLE;

	public static long ALT_OLY_WPERIOD;

	public static long ALT_OLY_VPERIOD;

	public static int ALT_OLY_CLASSED;

	public static int ALT_OLY_NONCLASSED;

	public static int ALT_OLY_REG_DISPLAY;

	public static int ALT_OLY_BATTLE_REWARD_ITEM;

	public static int ALT_OLY_CLASSED_RITEM_C;

	public static int ALT_OLY_NONCLASSED_RITEM_C;

	public static int ALT_OLY_COMP_RITEM;

	public static int ALT_OLY_GP_PER_POINT;

	public static int ALT_OLY_HERO_POINTS;

	public static int ALT_OLY_RANK1_POINTS;

	public static int ALT_OLY_RANK2_POINTS;

	public static int ALT_OLY_RANK3_POINTS;

	public static int ALT_OLY_RANK4_POINTS;

	public static int ALT_OLY_RANK5_POINTS;

	public static int ALT_OLY_MAX_POINTS;

	public static boolean ALT_OLY_LOG_FIGHTS;

	public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;

	public static boolean ALT_OLY_ANNOUNCE_GAMES;

	public static List<Integer> LIST_OLY_RESTRICTED_ITEMS = new FastList<Integer>();

	public static int ALT_OLY_ENCHANT_LIMIT;

	public static int ALT_MANOR_REFRESH_TIME;

	public static int ALT_MANOR_REFRESH_MIN;

	public static int ALT_MANOR_APPROVE_TIME;

	public static int ALT_MANOR_APPROVE_MIN;

	public static int ALT_MANOR_MAINTENANCE_PERIOD;

	public static boolean ALT_MANOR_SAVE_ALL_ACTIONS;

	public static int ALT_MANOR_SAVE_PERIOD_RATE;

	public static long ALT_LOTTERY_PRIZE;

	public static long ALT_LOTTERY_TICKET_PRICE;

	public static float ALT_LOTTERY_5_NUMBER_RATE;

	public static float ALT_LOTTERY_4_NUMBER_RATE;

	public static float ALT_LOTTERY_3_NUMBER_RATE;

	public static long ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;

	public static int FS_TIME_ATTACK;

	public static int FS_TIME_COOLDOWN;

	public static int FS_TIME_ENTRY;

	public static int FS_TIME_WARMUP;

	public static int FS_PARTY_MEMBER_COUNT;

	public static int RIFT_MIN_PARTY_SIZE;

	public static int RIFT_SPAWN_DELAY;

	public static int RIFT_MAX_JUMPS;

	public static int RIFT_AUTO_JUMPS_TIME_MIN;

	public static int RIFT_AUTO_JUMPS_TIME_MAX;

	public static float RIFT_BOSS_ROOM_TIME_MUTIPLY;

	public static int RIFT_ENTER_COST_RECRUIT;

	public static int RIFT_ENTER_COST_SOLDIER;

	public static int RIFT_ENTER_COST_OFFICER;

	public static int RIFT_ENTER_COST_CAPTAIN;

	public static int RIFT_ENTER_COST_COMMANDER;

	public static int RIFT_ENTER_COST_HERO;

	public static int DEFAULT_PUNISH;

	public static int DEFAULT_PUNISH_PARAM;

	public static boolean ONLY_GM_ITEMS_FREE;

	public static boolean JAIL_IS_PVP;

	public static boolean JAIL_DISABLE_CHAT;

	public static boolean SAVE_GMSPAWN_ON_CUSTOM;

	public static boolean DELETE_GMSPAWN_ON_CUSTOM;

	public static boolean CUSTOM_NPC_TABLE;

	public static boolean CUSTOM_ITEM_TABLES;

	public static boolean CUSTOM_ARMORSETS_TABLE;

	public static boolean CUSTOM_TELEPORT_TABLE;

	public static boolean CUSTOM_DROPLIST_TABLE;

	public static boolean CUSTOM_MERCHANT_TABLES;

	/**
	 * 世界聊天等级下限设置
	 */
	public static int GLOBALCHATLEVELSET;

	/**
	 * 世界聊天扣钱(单位：银文)
	 */
	public static int GLOBALCHATCOSTS;

	// 寄售系统相关参数
	public static float XX4;

	public static float XX8;

	public static float XX12;

	public static float XX24;

	/**
	 * 购买寄售物品缴税率
	 */
	public static float CONSIGNMENTDUTY;

	/**
	 * 寄售分页大小
	 */
	public static int CPAGESIZE;

	// --------------------------------------------------
	// FloodProtector Settings
	// --------------------------------------------------
	public static FloodProtectorConfig FLOOD_PROTECTOR_USE_ITEM;

	public static FloodProtectorConfig FLOOD_PROTECTOR_ROLL_DICE;

	public static FloodProtectorConfig FLOOD_PROTECTOR_FIREWORK;

	public static FloodProtectorConfig FLOOD_PROTECTOR_ITEM_PET_SUMMON;

	public static FloodProtectorConfig FLOOD_PROTECTOR_HERO_VOICE;

	public static FloodProtectorConfig FLOOD_PROTECTOR_GLOBAL_CHAT;

	public static FloodProtectorConfig FLOOD_PROTECTOR_SUBCLASS;

	public static FloodProtectorConfig FLOOD_PROTECTOR_DROP_ITEM;

	public static FloodProtectorConfig FLOOD_PROTECTOR_SERVER_BYPASS;

	public static FloodProtectorConfig FLOOD_PROTECTOR_MULTISELL;

	public static FloodProtectorConfig FLOOD_PROTECTOR_TRANSACTION;

	// --------------------------------------------------
	// L2JMods Settings
	// --------------------------------------------------

	public static boolean TVT_EVENT_ENABLED;

	public static boolean TVT_EVENT_IN_INSTANCE;

	public static String TVT_EVENT_INSTANCE_FILE;

	public static String[] TVT_EVENT_INTERVAL;

	public static int TVT_EVENT_PARTICIPATION_TIME;

	public static int TVT_EVENT_RUNNING_TIME;

	public static int TVT_EVENT_PARTICIPATION_NPC_ID;

	public static int[] TVT_EVENT_PARTICIPATION_NPC_COORDINATES = new int[3];

	public static int[] TVT_EVENT_PARTICIPATION_FEE = new int[2];

	public static int TVT_EVENT_MIN_PLAYERS_IN_TEAMS;

	public static int TVT_EVENT_MAX_PLAYERS_IN_TEAMS;

	public static int TVT_EVENT_RESPAWN_TELEPORT_DELAY;

	public static int TVT_EVENT_START_LEAVE_TELEPORT_DELAY;

	public static String TVT_EVENT_TEAM_1_NAME;

	public static int[] TVT_EVENT_TEAM_1_COORDINATES = new int[3];

	public static String TVT_EVENT_TEAM_2_NAME;

	public static int[] TVT_EVENT_TEAM_2_COORDINATES = new int[3];

	public static List<int[]> TVT_EVENT_REWARDS = new FastList<int[]>();

	public static boolean TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED;

	public static boolean TVT_EVENT_SCROLL_ALLOWED;

	public static boolean TVT_EVENT_POTIONS_ALLOWED;

	public static boolean TVT_EVENT_SUMMON_BY_ITEM_ALLOWED;

	public static List<Integer> TVT_DOORS_IDS_TO_OPEN = new ArrayList<Integer>();

	public static List<Integer> TVT_DOORS_IDS_TO_CLOSE = new ArrayList<Integer>();

	public static boolean TVT_REWARD_TEAM_TIE;

	public static byte TVT_EVENT_MIN_LVL;

	public static byte TVT_EVENT_MAX_LVL;

	public static int TVT_EVENT_EFFECTS_REMOVAL;

	public static Map<Integer, Integer> TVT_EVENT_FIGHTER_BUFFS;

	public static Map<Integer, Integer> TVT_EVENT_MAGE_BUFFS;

	public static boolean TVT_ALLOW_VOICED_COMMAND;

	public static boolean L2JMOD_ALLOW_WEDDING;

	public static int L2JMOD_WEDDING_PRICE;

	public static boolean L2JMOD_WEDDING_PUNISH_INFIDELITY;

	public static boolean L2JMOD_WEDDING_TELEPORT;

	public static int L2JMOD_WEDDING_TELEPORT_PRICE;

	public static int L2JMOD_WEDDING_TELEPORT_DURATION;

	public static boolean L2JMOD_WEDDING_SAMESEX;

	public static boolean L2JMOD_WEDDING_FORMALWEAR;

	public static int L2JMOD_WEDDING_DIVORCE_COSTS;

	public static boolean BANKING_SYSTEM_ENABLED;

	public static int BANKING_SYSTEM_GOLDBARS;

	public static int BANKING_SYSTEM_ADENA;

	public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_CLAN;

	public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;

	public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT;

	public static boolean OFFLINE_CRAFT_ENABLE;

	public static boolean OFFLINE_SET_NAME_COLOR;

	public static int OFFLINE_NAME_COLOR;

	public static boolean L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;

	// --------------------------------------------------
	// NPC Settings
	// --------------------------------------------------
	public static boolean ANNOUNCE_MAMMON_SPAWN;

	public static boolean ALT_MOB_AGRO_IN_PEACEZONE;

	public static boolean ALT_GAME_VIEWNPC;

	public static int MAX_DRIFT_RANGE;

	public static boolean DEEPBLUE_DROP_RULES;

	public static boolean DEEPBLUE_DROP_RULES_RAID;

	public static boolean SHOW_NPC_LVL;

	public static boolean GUARD_ATTACK_AGGRO_MOB;

	public static boolean ALLOW_WYVERN_UPGRADER;

	public static String PET_RENT_NPC;

	public static List<Integer> LIST_PET_RENT_NPC = new FastList<Integer>();

	public static int RAID_MINION_RESPAWN_TIMER;

	public static boolean RAID_DISABLE_CURSE;

	public static int INVENTORY_MAXIMUM_PET;

	// --------------------------------------------------
	// PvP Settings
	// --------------------------------------------------

	/**
	 * 玩家每次增加的善恶值的数据
	 */
	public static int KARMA_MIN_KARMA;

	/**
	 * 玩家的善恶值的上限
	 */
	public static int KARMA_MAX_KARMA;

	public static int KARMA_XP_DIVIDER;

	public static int KARMA_LOST_BASE;

	public static boolean KARMA_DROP_GM;

	public static boolean KARMA_AWARD_PK_KILL;

	public static int KARMA_PK_LIMIT;

	public static String KARMA_NONDROPPABLE_PET_ITEMS;

	public static String KARMA_NONDROPPABLE_ITEMS;

	public static int[] KARMA_LIST_NONDROPPABLE_PET_ITEMS;

	public static int[] KARMA_LIST_NONDROPPABLE_ITEMS;

	// --------------------------------------------------
	// Rate Settings
	// --------------------------------------------------

	public static float RATE_QUESTS_REWARD;

	public static float RATE_DROP_ADENA;

	public static float RATE_CONSUMABLE_COST;

	public static float RATE_EXTR_FISH;

	public static float RATE_DROP_ITEMS;

	public static float RATE_DROP_ITEMS_BY_RAID;

	public static float RATE_DROP_SPOIL;

	public static int RATE_DROP_MANOR;

	public static float RATE_DROP_QUEST;

	public static float RATE_KARMA_EXP_LOST;

	public static float RATE_SIEGE_GUARDS_PRICE;

	public static float RATE_DROP_COMMON_HERBS;

	public static float RATE_DROP_MP_HP_HERBS;

	public static float RATE_DROP_GREATER_HERBS;

	public static float RATE_DROP_SUPERIOR_HERBS;

	public static float RATE_DROP_SPECIAL_HERBS;

	public static int PLAYER_DROP_LIMIT;

	public static int PLAYER_RATE_DROP;

	public static int PLAYER_RATE_DROP_ITEM;

	public static int PLAYER_RATE_DROP_EQUIP;

	public static int PLAYER_RATE_DROP_EQUIP_WEAPON;

	public static float PET_XP_RATE;

	public static int PET_FOOD_RATE;

	public static float SINEATER_XP_RATE;

	public static int KARMA_DROP_LIMIT;

	public static int KARMA_RATE_DROP;

	public static int KARMA_RATE_DROP_ITEM;

	public static int KARMA_RATE_DROP_EQUIP;

	public static int KARMA_RATE_DROP_EQUIP_WEAPON;

	public static double[] PLAYER_XP_PERCENT_LOST;

	/**
	 * 好友上限
	 */
	public static int FRIENDSLIMIT;

	/**
	 * 好友消息上限
	 */
	public static int FRIENDSNEWSLIMIT;

	/**
	 * 离线保存角色队伍时间
	 */
	public static int LOGOUTSPACETIME;

	/**
	 * 检测离线用户时间间隔
	 */
	public static int LOGOUTCHECKTIME;

	public static int LEVELUP_UNASSIGNPOINT;

	/**
	 * 元宝兑换成银文比率
	 */
	public static int INGOT2SILVERRATE;

	/**
	 * NPC修理买卖善恶值惩罚参数基数
	 */
	public static int KARMABASE;

	/**
	 * 红名善恶值大小设置
	 */
	public static int KARMAREDSSET;

	/**
	 * 角色昵称过滤器
	 */
	public static String[] NICKNAMEFILTER;

	// --------------------------------------------------
	// Server Settings
	// --------------------------------------------------
	/**
	 * 游戏服务器端口
	 */
	public static int PORT_GAME;

	/**
	 * 登录服务器外网端口
	 */
	public static int PORT_LOGIN;

	/**
	 * 登陆服务器外网地址
	 */
	public static String LOGIN_BIND_ADDRESS;

	/**
	 * 登陆服务器是否使用socket连接
	 */
	public static boolean LOGIN_SOCKET;

	/**
	 * 在被绑前登陆失败的重试次数
	 */
	public static int LOGIN_TRY_BEFORE_BAN;

	/**
	 * 被绑后解绑的时间（秒）
	 */
	public static int LOGIN_BLOCK_AFTER_BAN;

	/**
	 * 游戏服务器本地地址
	 */
	public static String GAMESERVER_HOSTNAME;

	/**
	 * 数据库驱动
	 */
	public static String DATABASE_DRIVER;

	/**
	 * 数据库地址
	 */
	public static String DATABASE_URL;

	/**
	 * 数据库账户
	 */
	public static String DATABASE_LOGIN;

	/**
	 * 数据库密码
	 */
	public static String DATABASE_PASSWORD;

	/**
	 * 数据库最大的连接数
	 */
	public static int DATABASE_MAX_CONNECTIONS;

	/**
	 * 数据库连接最大的空闲时间
	 */
	public static int DATABASE_MAX_IDLE_TIME;

	/**
	 * 最大在线用户数
	 */
	public static int MAXIMUM_ONLINE_USERS;

	/**
	 * 玩家取名的正则表达式格式模板（详见server.properties）
	 */
	public static String CNAME_TEMPLATE;

	/**
	 * 宠物取名的正则表达式格式模板（详见server.properties）
	 */
	public static String PET_NAME_TEMPLATE;

	/**
	 * 每个账户拥有的最大的角色数量
	 */
	public static int MAX_CHARACTERS_NUMBER_PER_ACCOUNT;

	/**
	 * 数据包的根路径
	 */
	public static File DATAPACK_ROOT;

	/**
	 * 是否允许服务器的ID被修改
	 */
	public static boolean ACCEPT_ALTERNATE_ID;

	/**
	 * 游戏服务器的向登陆服务器请求的唯一标示ID
	 */
	public static int REQUEST_ID;

	/**
	 * 连接服务器所需的最小协议版本号
	 */
	public static int MIN_PROTOCOL_REVISION;

	/**
	 * 连接服务器所需的最大的协议版本号
	 */
	public static int MAX_PROTOCOL_REVISION;

	/**
	 * 连接服务器所需的最小客户端版本号
	 */
	public static int MIN_CLIENT_REVISION;

	/**
	 * 连接服务器所需的最大的客户端版本号
	 */
	public static int MAX_CLIENT_REVISION;

	public static String GAME_HOST_NAME;

	/**
	 * 是否在日志中记录登陆的情况
	 */
	public static boolean LOG_LOGIN_CONTROLLER;

	// --------------------------------------------------
	// NetCore Settings
	// --------------------------------------------------
	public static int NETCORE_SELECTOR_SLEEP_TIME;

	public static int NETCORE_MAX_SEND_PER_PASS;

	public static int NETCORE_MAX_READ_PER_PASS;

	public static int NETCORE_HELPER_BUFFER_COUNT;

	// --------------------------------------------------
	// No classification assigned to the following yet
	// --------------------------------------------------
	public static int MAX_ITEM_IN_PACKET;

	public static boolean CHECK_KNOWN;

	/**
	 * 游戏服务器连接登陆服务器的地址（内网地址）
	 */
	public static String GAME_SERVER_LOGIN_HOST;

	/**
	 * 游戏服务器连接登陆服务器的端口（内网端口）
	 */
	public static int GAME_SERVER_LOGIN_PORT;

	/**
	 * 服务器内部地址显示在登录服务器下发的列表中的地址
	 */
	public static String INTERNAL_HOSTNAME;

	/**
	 * 服务器外部地址显示在登录服务器下发的列表中的地址
	 */
	public static String EXTERNAL_HOSTNAME;

	/**
	 * 路由器地址
	 */
	public static String ROUTER_HOSTNAME;

	public static int NEW_NODE_ID;

	public static int SELECTED_NODE_ID;

	public static int LINKED_NODE_ID;

	public static String NEW_NODE_TYPE;

	public static String SERVER_VERSION;

	public static String SERVER_BUILD_DATE;

	public static String DATAPACK_VERSION;

	public static int PVP_NORMAL_TIME;

	public static int PVP_PVP_TIME;

	public static enum IdFactoryType {
		Compaction, BitSet, Stack, GUID
	}

	public static IdFactoryType IDFACTORY_TYPE;

	public static boolean BAD_ID_CHECKING;

	public static enum ObjectMapType {
		L2ObjectHashMap, WorldObjectMap
	}

	public static enum ObjectSetType {
		L2ObjectHashSet, WorldObjectSet
	}

	public static ObjectMapType MAP_TYPE;

	public static ObjectSetType SET_TYPE;

	/**
	 * 武器强化的成功率
	 */
	public static int ENCHANT_CHANCE_WEAPON;

	/**
	 * 装备强化的成功率
	 */
	public static int ENCHANT_CHANCE_ARMOR;

	/**
	 * 武器最大的强化次数
	 */
	public static int ENCHANT_MAX_WEAPON;

	/**
	 * 装备最大的强化次数
	 */
	public static int ENCHANT_MAX_ARMOR;

	public static boolean IS_TELNET_ENABLED;

	public static boolean SHOW_LICENCE;

	public static boolean FORCE_GGAUTH;

	/**
	 * 登陆服务器是否接受新的游戏服务器注册
	 */
	public static boolean ACCEPT_NEW_GAMESERVER;

	/**
	 * 游戏服务器最终从登陆服务器获取的服务器ID
	 */
	public static int SERVER_ID;

	/**
	 * 是否自动创建账户
	 */
	public static boolean AUTO_CREATE_ACCOUNTS;

	/**
	 * 是否启用注册账户功能
	 */
	public static boolean CREATEACCOUNTS;

	/**
	 * 登陆服务器账户名正则规则
	 */
	public static String ACCOUNT_NAME_TEMPLATE;

	/**
	 * 登陆服务器账户的密码正则规则
	 */
	public static String ACCOUNT_PASSWORD_TEMPLATE;

	/**
	 * 登陆服务器电话号码正则规则
	 */
	public static String ACCOUNT_PHONENO_TEMPLATE;

	/**
	 * 是否启用登录服务防止游戏服务器的洪水攻击保护
	 */
	public static boolean FLOOD_PROTECTION_GAMESERVER;

	public static int FAST_CONNECTION_LIMIT_GAMESERVER;

	public static int NORMAL_CONNECTION_TIME;

	public static int FAST_CONNECTION_TIME;

	public static int MAX_CONNECTION_PER_IP;

	/**
	 * 用户登陆超时时间设置，默认一分钟
	 */
	public static int LOGIN_TIMEOUT;

	/**
	 * 是否启用登录服务防止客户端的洪水攻击保护
	 */
	public static boolean FLOOD_PROTECTION_CLIENT;

	public static int FAST_CONNECTION_LIMIT_CLIENT;

	public static boolean RELEASELIST;

	public static String LEARN_SKILL_LVL;

	/**
	 * This class initializes all global variables for configuration.<br>
	 * If the key doesn't appear in properties file, a default value is set by
	 * this class.
	 * 
	 * @see CONFIGURATION_FILE (properties file) for configuring your server.
	 */
	public static void load() {
		// 无论登陆服务还是游戏服务先加载日志系统
		LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
		try {
			JoranConfigurator configurator = new JoranConfigurator();
			configurator.setContext(lc);
			// the context was probably already configured by default
			// configuration rules
			lc.reset();
			configurator.doConfigure(LOG_CONFIG_FILE);
			_log.info("Loading LogSystem success!", Config.SERVER_ID, "LogSystem");
		} catch (Exception ex) {
			System.err.println("load LogSystem fail!check it!");
			ex.printStackTrace();
		}
		if (Server.serverMode == Server.MODE_GAMESERVER) {
			_log.info("Loading GameServer Configuration Files...", Config.SERVER_ID, "configfile");
			InputStream is = null;
			try {

				try {
					FLOOD_PROTECTOR_USE_ITEM = new FloodProtectorConfig("UseItemFloodProtector");
					FLOOD_PROTECTOR_ROLL_DICE = new FloodProtectorConfig("RollDiceFloodProtector");
					FLOOD_PROTECTOR_FIREWORK = new FloodProtectorConfig("FireworkFloodProtector");
					FLOOD_PROTECTOR_ITEM_PET_SUMMON = new FloodProtectorConfig("ItemPetSummonFloodProtector");
					FLOOD_PROTECTOR_HERO_VOICE = new FloodProtectorConfig("HeroVoiceFloodProtector");
					FLOOD_PROTECTOR_GLOBAL_CHAT = new FloodProtectorConfig("GlobalChatFloodProtector");
					FLOOD_PROTECTOR_SUBCLASS = new FloodProtectorConfig("SubclassFloodProtector");
					FLOOD_PROTECTOR_DROP_ITEM = new FloodProtectorConfig("DropItemFloodProtector");
					FLOOD_PROTECTOR_SERVER_BYPASS = new FloodProtectorConfig("ServerBypassFloodProtector");
					FLOOD_PROTECTOR_MULTISELL = new FloodProtectorConfig("MultiSellFloodProtector");
					FLOOD_PROTECTOR_TRANSACTION = new FloodProtectorConfig("TransactionFloodProtector");

					L2Properties serverSettings = new L2Properties();
					is = new FileInputStream(new File(CONFIGURATION_FILE));
					serverSettings.load(is, "UTF-8");

					GAMESERVER_HOSTNAME = serverSettings.getProperty("GameserverHostname");
					PORT_GAME = Integer.parseInt(serverSettings.getProperty("GameserverPort", "8014"));

					EXTERNAL_HOSTNAME = serverSettings.getProperty("ExternalHostname", "*");
					INTERNAL_HOSTNAME = serverSettings.getProperty("InternalHostname", "*");

					GAME_SERVER_LOGIN_PORT = Integer.parseInt(serverSettings.getProperty("LoginPort", "9014"));
					GAME_SERVER_LOGIN_HOST = serverSettings.getProperty("LoginHost", "*");

					SERVER_ID = REQUEST_ID = Integer.parseInt(serverSettings.getProperty("RequestServerID", "0"));
					ACCEPT_ALTERNATE_ID = Boolean.parseBoolean(serverSettings.getProperty("AcceptAlternateID", "True"));

					DATABASE_DRIVER = serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
					DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/inndb");
					DATABASE_LOGIN = serverSettings.getProperty("Login", "root");
					DATABASE_PASSWORD = serverSettings.getProperty("Password", "root");
					DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
					DATABASE_MAX_IDLE_TIME = Integer.parseInt(serverSettings.getProperty("MaximumDbIdleTime", "0"));

					DATAPACK_ROOT = new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile();
					CNAME_TEMPLATE = serverSettings.getProperty("CnameTemplate", ".*");
					PET_NAME_TEMPLATE = serverSettings.getProperty("PetNameTemplate", ".*");

					MAX_CHARACTERS_NUMBER_PER_ACCOUNT = Integer.parseInt(serverSettings.getProperty("CharMaxNumber", "0"));
					MAXIMUM_ONLINE_USERS = Integer.parseInt(serverSettings.getProperty("MaximumOnlineUsers", "100"));

					MIN_CLIENT_REVISION = Integer.parseInt(serverSettings.getProperty("MinClientRevision", "0"));
					MAX_CLIENT_REVISION = Integer.parseInt(serverSettings.getProperty("MaxClientRevision", "0"));

					GAME_HOST_NAME = serverSettings.getProperty("GameHostname", "GameServer");

					if (MIN_CLIENT_REVISION > MAX_CLIENT_REVISION) {
						throw new Error("MinClientRevision is bigger than MaxClientRevision in server configuration file.");
					}
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + CONFIGURATION_FILE + " File.");
				}

				try {
					L2Properties serverSettings = new L2Properties();
					is = new FileInputStream(new File(LOGIN_CONFIGURATION_FILE));
					serverSettings.load(is);
					ACCOUNT_NAME_TEMPLATE = serverSettings.getProperty("AnameTemplate", ".*");
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + LOGIN_CONFIGURATION_FILE + " File.");
				}

				// 装载特性文件 (如果存在)
				try {
					L2Properties Feature = new L2Properties();
					is = new FileInputStream(new File(FEATURE_CONFIG_FILE));
					Feature.load(is);
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + FEATURE_CONFIG_FILE + " File.");
				}

				// Load Character L2Properties file (if exists)
				try {
					L2Properties Character = new L2Properties();
					is = new FileInputStream(new File(CHARACTER_CONFIG_FILE));
					Character.load(is, "UTF-8");

					LEARN_SKILL_LVL = Character.getProperty("LearnSkillLevel", null);
					MASTERACCESS_LEVEL = Integer.parseInt(Character.getProperty("MasterAccessLevel", "127"));
					MASTERACCESS_NAME_COLOR = Integer.decode(StringUtil.concat("0x", Character.getProperty("MasterNameColor", "00FF00")));
					MASTERACCESS_TITLE_COLOR = Integer.decode(StringUtil.concat("0x", Character.getProperty("MasterTitleColor", "00FF00")));
					RESPAWN_RESTORE_HP = Float.parseFloat(Character.getProperty("RespawnRestoreHP", "70")) / 100;
					RESPAWN_RESTORE_MP = Float.parseFloat(Character.getProperty("RespawnRestoreMP", "70")) / 100;
					RESPAWN_COST = Integer.parseInt(Character.getProperty("RespawnCost", "1"));

					BUFFS_MAX_AMOUNT = Byte.parseByte(Character.getProperty("maxbuffamount", "20"));

					EFFECT_CANCELING = Boolean.parseBoolean(Character.getProperty("CancelLesserEffect", "True"));

					ALT_GAME_MAGICFAILURES = Boolean.parseBoolean(Character.getProperty("MagicFailures", "true"));

					STORE_SKILL_COOLTIME = Boolean.parseBoolean(Character.getProperty("StoreSkillCooltime", "true"));

					ALLOW_CLASS_MASTERS = Boolean.parseBoolean(Character.getProperty("AllowClassMasters", "False"));
					ALLOW_ENTIRE_TREE = Boolean.parseBoolean(Character.getProperty("AllowEntireTree", "False"));

					ALT_GAME_SKILL_LEARN = Boolean.parseBoolean(Character.getProperty("AltGameSkillLearn", "false"));

					MAX_RUN_SPEED = Integer.parseInt(Character.getProperty("MaxRunSpeed", "8"));

					MAX_CRIT_RATE = Integer.parseInt(Character.getProperty("MaxCritRate", "100"));
					CRIT_DMG_RATE = Float.parseFloat(Character.getProperty("CritDmgRate", "1.5"));

					MAX_PATK_SPEED = Integer.parseInt(Character.getProperty("MaxPAtkSpeed", "1500"));
					MAX_MATK_SPEED = Integer.parseInt(Character.getProperty("MaxMAtkSpeed", "1999"));

					MAX_PVTSTORESELL_SLOTS_OTHER = Integer.parseInt(Character.getProperty("MaxPvtStoreSellSlotsOther", "3"));
					MAX_PVTSTOREBUY_SLOTS_OTHER = Integer.parseInt(Character.getProperty("MaxPvtStoreBuySlotsOther", "4"));

					INVENTORY_MAXIMUM = Integer.parseInt(Character.getProperty("MaximumSlotsForNoDwarf", "80"));

					INVENTORY_MAXIMUM_GM = Integer.parseInt(Character.getProperty("MaximumSlotsForGMPlayer", "250"));
					MAX_ITEM_IN_PACKET = INVENTORY_MAXIMUM_GM;

					WAREHOUSE_SLOTS_NO_DWARF = Integer.parseInt(Character.getProperty("MaximumWarehouseSlotsForNoDwarf", "100"));
					WAREHOUSE_SLOTS_CLAN = Integer.parseInt(Character.getProperty("MaximumWarehouseSlotsForClan", "150"));
					FREIGHT_SLOTS = Integer.parseInt(Character.getProperty("MaximumFreightSlots", "20"));

					ENCHANT_CHANCE_WEAPON = Integer.parseInt(Character.getProperty("EnchantChanceWeapon", "66"));

					ENCHANT_CHANCE_ARMOR = Integer.parseInt(Character.getProperty("EnchantChanceArmor", "66"));

					ENCHANT_MAX_WEAPON = Integer.parseInt(Character.getProperty("EnchantMaxWeapon", "0"));
					ENCHANT_MAX_ARMOR = Integer.parseInt(Character.getProperty("EnchantMaxArmor", "0"));

					ALT_GAME_KARMA_PLAYER_CAN_BE_KILLED_IN_PEACEZONE = Boolean.parseBoolean(Character.getProperty("AltKarmaPlayerCanBeKilledInPeaceZone", "false"));
					ALT_GAME_KARMA_PLAYER_CAN_SHOP = Boolean.parseBoolean(Character.getProperty("AltKarmaPlayerCanShop", "true"));
					ALT_GAME_KARMA_PLAYER_CAN_TRADE = Boolean.parseBoolean(Character.getProperty("AltKarmaPlayerCanTrade", "true"));
					ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE = Boolean.parseBoolean(Character.getProperty("AltKarmaPlayerCanUseWareHouse", "true"));

					ALT_CLAN_JOIN_DAYS = Integer.parseInt(Character.getProperty("DaysBeforeJoinAClan", "1"));
					ALT_CLAN_CREATE_DAYS = Integer.parseInt(Character.getProperty("DaysBeforeCreateAClan", "10"));
					ALT_CLAN_DISSOLVE_DAYS = Integer.parseInt(Character.getProperty("DaysToPassToDissolveAClan", "7"));
					ALT_ALLY_JOIN_DAYS_WHEN_LEAVED = Integer.parseInt(Character.getProperty("DaysBeforeJoinAllyWhenLeaved", "1"));
					ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED = Integer.parseInt(Character.getProperty("DaysBeforeJoinAllyWhenDismissed", "1"));
					ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED = Integer.parseInt(Character.getProperty("DaysBeforeAcceptNewClanWhenDismissed", "1"));
					ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED = Integer.parseInt(Character.getProperty("DaysBeforeCreateNewAllyWhenDissolved", "1"));
					ALT_MAX_NUM_OF_CLANS_IN_ALLY = Integer.parseInt(Character.getProperty("AltMaxNumOfClansInAlly", "3"));
					ALT_CLAN_MEMBERS_FOR_WAR = Integer.parseInt(Character.getProperty("AltClanMembersForWar", "15"));
					ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH = Boolean.parseBoolean(Character.getProperty("AltMembersCanWithdrawFromClanWH", "false"));
					REMOVE_CASTLE_CIRCLETS = Boolean.parseBoolean(Character.getProperty("RemoveCastleCirclets", "true"));

					ALT_PARTY_RANGE = Integer.parseInt(Character.getProperty("AltPartyRange", "1600"));
					ALT_PARTY_RANGE2 = Integer.parseInt(Character.getProperty("AltPartyRange2", "1400"));
					STARTING_ADENA = Integer.parseInt(Character.getProperty("StartingAdena", "0"));
					STARTING_LEVEL = Byte.parseByte(Character.getProperty("StartingLevel", "1"));

					AUTO_LOOT = Boolean.parseBoolean(Character.getProperty("AutoLoot", "false"));
					AUTO_LOOT_RAIDS = Boolean.parseBoolean(Character.getProperty("AutoLootRaids", "false"));
					UNSTUCK_INTERVAL = Integer.parseInt(Character.getProperty("UnstuckInterval", "300"));

					PLAYER_SPAWN_PROTECTION = Integer.parseInt(Character.getProperty("PlayerSpawnProtection", "0"));
					RESPAWN_RANDOM_ENABLED = Boolean.parseBoolean(Character.getProperty("RespawnRandomInTown", "True"));
					RESPAWN_RANDOM_MAX_OFFSET = Integer.parseInt(Character.getProperty("RespawnRandomMaxOffset", "50"));
					RESTORE_PLAYER_INSTANCE = Boolean.parseBoolean(Character.getProperty("RestorePlayerInstance", "False"));
					ALLOW_SUMMON_TO_INSTANCE = Boolean.parseBoolean(Character.getProperty("AllowSummonToInstance", "True"));
					PETITIONING_ALLOWED = Boolean.parseBoolean(Character.getProperty("PetitioningAllowed", "True"));
					MAX_PETITIONS_PER_PLAYER = Integer.parseInt(Character.getProperty("MaxPetitionsPerPlayer", "5"));
					MAX_PETITIONS_PENDING = Integer.parseInt(Character.getProperty("MaxPetitionsPending", "25"));
					ALT_GAME_FREIGHTS = Boolean.parseBoolean(Character.getProperty("AltGameFreights", "true"));
					ALT_GAME_FREIGHT_PRICE = Integer.parseInt(Character.getProperty("AltGameFreightPrice", "1000"));
					ALT_GAME_FREE_TELEPORT = Boolean.parseBoolean(Character.getProperty("AltFreeTeleporting", "False"));
					ALT_RECOMMEND = Boolean.parseBoolean(Character.getProperty("AltRecommend", "False"));
					DELETE_DAYS = Integer.parseInt(Character.getProperty("DeleteCharAfterDays", "7"));

					ALT_GAME_EXPONENT_XP = Float.parseFloat(Character.getProperty("AltGameExponentXp", "1."));

					PARTY_XP_CUTOFF_METHOD = Character.getProperty("PartyXpCutoffMethod", "auto");
					PARTY_XP_CUTOFF_PERCENT = Double.parseDouble(Character.getProperty("PartyXpCutoffPercent", "3."));
					PARTY_XP_CUTOFF_LEVEL = Integer.parseInt(Character.getProperty("PartyXpCutoffLevel", "30"));
					FRIENDSLIMIT = Integer.parseInt(Character.getProperty("FriendsLimit", "50"));
					FRIENDSNEWSLIMIT = Integer.parseInt(Character.getProperty("FriendsNewsLimit", "50"));
					LOGOUTSPACETIME = Integer.parseInt(Character.getProperty("LogOutSpaceTime", "600000"));
					LOGOUTCHECKTIME = Integer.parseInt(Character.getProperty("LogOutCheckTime", "600000"));
					PK_LEVEL_MIN = Integer.parseInt(Character.getProperty("pk_level_min", "20"));
					LEVELUP_UNASSIGNPOINT = Integer.parseInt(Character.getProperty("LevelUpUnassignPoint", "2"));
					INGOT2SILVERRATE = Integer.parseInt(Character.getProperty("IngotToSilverRate", "1"));
					KARMABASE = Integer.parseInt(Character.getProperty("KarmaBase", "250"));
					KARMAREDSSET = Integer.parseInt(Character.getProperty("KarmaRedsSet", "50"));
					NICKNAMEFILTER = Character.getProperty("NickNameFilter", "").split(",");
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + CHARACTER_CONFIG_FILE + " file.");
				}

				// Load L2J Server Version L2Properties file (if exists)
				try {
					L2Properties serverVersion = new L2Properties();
					is = new FileInputStream(new File(SERVER_VERSION_FILE));
					serverVersion.load(is);

					SERVER_VERSION = serverVersion.getProperty("version", "Unsupported Custom Version.");
					SERVER_BUILD_DATE = serverVersion.getProperty("builddate", "Undefined Date.");
					is.close();
				} catch (Exception e) {
					// Ignore L2Properties file if it doesnt exist
					SERVER_VERSION = "Unsupported Custom Version.";
					SERVER_BUILD_DATE = "Undefined Date.";
				}

				// Load L2J Datapack Version L2Properties file (if exists)
				try {
					L2Properties serverVersion = new L2Properties();
					is = new FileInputStream(new File(DATAPACK_VERSION_FILE));
					serverVersion.load(is);

					DATAPACK_VERSION = serverVersion.getProperty("version", "Unsupported Custom Version.");
					is.close();
				} catch (Exception e) {
					// Ignore L2Properties file if it doesnt exist
					DATAPACK_VERSION = "Unsupported Custom Version.";
				}

				// Load Telnet L2Properties file (if exists)
				try {
					L2Properties telnetSettings = new L2Properties();
					is = new FileInputStream(new File(TELNET_FILE));
					telnetSettings.load(is);

					IS_TELNET_ENABLED = Boolean.parseBoolean(telnetSettings.getProperty("EnableTelnet", "false"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + TELNET_FILE + " File.");
				}

				// 装载底层网络配置
				try {
					_log.info("Loading " + NETCORE_CONFIG_FILE.replaceAll("./src/labox/innovation/config/", ""), Config.SERVER_ID, "netcore");
					L2Properties mmoSettings = new L2Properties();
					is = new FileInputStream(new File(NETCORE_CONFIG_FILE));
					mmoSettings.load(is);
					NETCORE_SELECTOR_SLEEP_TIME = Integer.parseInt(mmoSettings.getProperty("SleepTime", "20"));
					NETCORE_MAX_SEND_PER_PASS = Integer.parseInt(mmoSettings.getProperty("MaxSendPerPass", "12"));
					NETCORE_MAX_READ_PER_PASS = Integer.parseInt(mmoSettings.getProperty("MaxReadPerPass", "12"));
					NETCORE_HELPER_BUFFER_COUNT = Integer.parseInt(mmoSettings.getProperty("HelperBufferCount", "20"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + NETCORE_CONFIG_FILE + " File.");
				}

				// 装载ID工厂的配置 (if exists)
				try {
					L2Properties idSettings = new L2Properties();
					is = new FileInputStream(new File(ID_CONFIG_FILE));
					idSettings.load(is);

					MAP_TYPE = ObjectMapType.valueOf(idSettings.getProperty("L2Map", "WorldObjectMap"));
					SET_TYPE = ObjectSetType.valueOf(idSettings.getProperty("L2Set", "WorldObjectSet"));
					IDFACTORY_TYPE = IdFactoryType.valueOf(idSettings.getProperty("IDFactory", "GUID"));
					BAD_ID_CHECKING = Boolean.parseBoolean(idSettings.getProperty("BadIdChecking", "True"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + ID_CONFIG_FILE + " file.");
				}

				// 装载一般性配置 (if exists)
				try {
					L2Properties General = new L2Properties();
					is = new FileInputStream(new File(GENERAL_CONFIG_FILE));
					General.load(is, "UTF-8");

					ITEMDROPNUMS = Integer.parseInt(General.getProperty("ItemDropNums", "0"));
					ITEMRANDATTRIBUE = General.getProperty("ItemRandAttribute", null);
					PATHFINDING_MAX_NODE = Integer.parseInt(General.getProperty("PathFindingMaxNode", "800"));
					SYNC_LOCATION_INTERVAL = Integer.parseInt(General.getProperty("SyncLocationInterval", "2000"));
					SERVER_TYPE = Integer.parseInt(General.getProperty("ServerType", "0"));
					EVERYBODY_HAS_ADMIN_RIGHTS = Boolean.parseBoolean(General.getProperty("EverybodyHasAdminRights", "false"));
					DISPLAY_SERVER_VERSION = Boolean.parseBoolean(General.getProperty("DisplayServerRevision", "True"));
					SERVER_LIST_BRACKET = Boolean.parseBoolean(General.getProperty("ServerListBrackets", "false"));
					SERVER_LIST_CLOCK = Boolean.parseBoolean(General.getProperty("ServerListClock", "false"));
					SERVER_GMONLY = Boolean.parseBoolean(General.getProperty("ServerGMOnly", "false"));
					GM_HERO_AURA = Boolean.parseBoolean(General.getProperty("GMHeroAura", "False"));
					GM_STARTUP_INVULNERABLE = Boolean.parseBoolean(General.getProperty("GMStartupInvulnerable", "False"));
					GM_STARTUP_INVISIBLE = Boolean.parseBoolean(General.getProperty("GMStartupInvisible", "False"));
					GM_STARTUP_SILENCE = Boolean.parseBoolean(General.getProperty("GMStartupSilence", "False"));
					GM_STARTUP_AUTO_LIST = Boolean.parseBoolean(General.getProperty("GMStartupAutoList", "False"));
					GM_STARTUP_DIET_MODE = Boolean.parseBoolean(General.getProperty("GMStartupDietMode", "False"));
					GM_ADMIN_MENU_STYLE = General.getProperty("GMAdminMenuStyle", "modern");
					GM_ITEM_RESTRICTION = Boolean.parseBoolean(General.getProperty("GMItemRestriction", "True"));
					GM_SKILL_RESTRICTION = Boolean.parseBoolean(General.getProperty("GMSkillRestriction", "True"));
					GM_TRADE_RESTRICTED_ITEMS = Boolean.parseBoolean(General.getProperty("GMTradeRestrictedItems", "False"));
					GM_RESTART_FIGHTING = Boolean.parseBoolean(General.getProperty("GMRestartFighting", "False"));
					BYPASS_VALIDATION = Boolean.parseBoolean(General.getProperty("BypassValidation", "True"));
					GAMEGUARD_ENFORCE = Integer.parseInt(General.getProperty("GameGuardEnforce", "0"));
					GAMEGUARD_PROHIBITACTION = Boolean.parseBoolean(General.getProperty("GameGuardProhibitAction", "False"));
					LOG_CHAT = Boolean.parseBoolean(General.getProperty("LogChat", "false"));
					LOG_ITEMS = Boolean.parseBoolean(General.getProperty("LogItems", "false"));
					LOG_ITEM_ENCHANTS = Boolean.parseBoolean(General.getProperty("LogItemEnchants", "false"));
					LOG_SKILL_ENCHANTS = Boolean.parseBoolean(General.getProperty("LogSkillEnchants", "false"));
					GMAUDIT = Boolean.parseBoolean(General.getProperty("GMAudit", "False"));
					LOG_GAME_DAMAGE = Boolean.parseBoolean(General.getProperty("LogGameDamage", "False"));
					LOG_GAME_DAMAGE_THRESHOLD = Integer.parseInt(General.getProperty("LogGameDamageThreshold", "5000"));

					CACHE_CHAR_NAMES = Boolean.parseBoolean(General.getProperty("CacheCharNames", "False"));

					DEBUG = Boolean.parseBoolean(General.getProperty("Debug", "false"));
					PACKET_HANDLER_DEBUG = Boolean.parseBoolean(General.getProperty("PacketHandlerDebug", "false"));
					ASSERT = Boolean.parseBoolean(General.getProperty("Assert", "false"));
					DEVELOPER = Boolean.parseBoolean(General.getProperty("Developer", "false"));
					ACCEPT_GEOEDITOR_CONN = Boolean.parseBoolean(General.getProperty("AcceptGeoeditorConn", "false"));
					TEST_SERVER = Boolean.parseBoolean(General.getProperty("TestServer", "false"));
					SERVER_LIST_TESTSERVER = Boolean.parseBoolean(General.getProperty("ListTestServers", "false"));
					ALT_DEV_NO_QUESTS = Boolean.parseBoolean(General.getProperty("AltDevNoQuests", "False"));
					GENERAL_THREAD_CORE_SIZE = Integer.parseInt(General.getProperty("GeneralThreadCoreSize", "4"));
					DEADLOCK_DETECTOR = Boolean.parseBoolean(General.getProperty("DeadLockDetector", "False"));

					DEADLOCK_CHECK_INTERVAL = Integer.parseInt(General.getProperty("DeadLockCheckInterval", "20"));
					RESTART_ON_DEADLOCK = Boolean.parseBoolean(General.getProperty("RestartOnDeadlock", "False"));

					ALLOW_DISCARDITEM = Boolean.parseBoolean(General.getProperty("AllowDiscardItem", "True"));
					AUTODESTROY_ITEM_AFTER = Integer.parseInt(General.getProperty("AutoDestroyDroppedItemAfter", "600"));
					HERB_AUTO_DESTROY_TIME = Integer.parseInt(General.getProperty("AutoDestroyHerbTime", "15")) * 1000;
					PROTECTED_ITEMS = General.getProperty("ListOfProtectedItems", "0");
					LIST_PROTECTED_ITEMS = new FastList<Integer>();
					for (String id : PROTECTED_ITEMS.split(",")) {
						LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
					}
					CHAR_STORE_INTERVAL = Integer.parseInt(General.getProperty("CharacterDataStoreInterval", "5"));
					CONSGNMENT_SAVE_INTERVAL = Integer.parseInt(General.getProperty("ConsgnmentSaveInterval", "5"));
					AUTO_COUNT_PLAYER_INTERVAL = Integer.parseInt(General.getProperty("AutoCountPlayerInterval", "5"));
					LAZY_ITEMS_UPDATE = Boolean.parseBoolean(General.getProperty("LazyItemsUpdate", "false"));
					UPDATE_ITEMS_ON_CHAR_STORE = Boolean.parseBoolean(General.getProperty("UpdateItemsOnCharStore", "false"));
					DESTROY_DROPPED_PLAYER_ITEM = Boolean.parseBoolean(General.getProperty("DestroyPlayerDroppedItem", "false"));
					DESTROY_EQUIPABLE_PLAYER_ITEM = Boolean.parseBoolean(General.getProperty("DestroyEquipableItem", "false"));
					SAVE_DROPPED_ITEM = Boolean.parseBoolean(General.getProperty("SaveDroppedItem", "false"));
					EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD = Boolean.parseBoolean(General.getProperty("EmptyDroppedItemTableAfterLoad", "false"));
					SAVE_DROPPED_ITEM_INTERVAL = Integer.parseInt(General.getProperty("SaveDroppedItemInterval", "60")) * 60000;
					CLEAR_DROPPED_ITEM_TABLE = Boolean.parseBoolean(General.getProperty("ClearDroppedItemTable", "false"));
					AUTODELETE_INVALID_QUEST_DATA = Boolean.parseBoolean(General.getProperty("AutoDeleteInvalidQuestData", "False"));
					PRECISE_DROP_CALCULATION = Boolean.parseBoolean(General.getProperty("PreciseDropCalculation", "True"));
					MULTIPLE_ITEM_DROP = Boolean.parseBoolean(General.getProperty("MultipleItemDrop", "True"));
					FORCE_INVENTORY_UPDATE = Boolean.parseBoolean(General.getProperty("ForceInventoryUpdate", "False"));
					LAZY_CACHE = Boolean.parseBoolean(General.getProperty("LazyCache", "True"));
					MIN_NPC_ANIMATION = Integer.parseInt(General.getProperty("MinNPCAnimation", "10"));
					MAX_NPC_ANIMATION = Integer.parseInt(General.getProperty("MaxNPCAnimation", "20"));
					MIN_MONSTER_ANIMATION = Integer.parseInt(General.getProperty("MinMonsterAnimation", "5"));
					MAX_MONSTER_ANIMATION = Integer.parseInt(General.getProperty("MaxMonsterAnimation", "20"));
					MOVE_BASED_KNOWNLIST = Boolean.parseBoolean(General.getProperty("MoveBasedKnownlist", "False"));
					KNOWNLIST_UPDATE_INTERVAL = Long.parseLong(General.getProperty("KnownListUpdateInterval", "1250"));
					GRIDS_ALWAYS_ON = Boolean.parseBoolean(General.getProperty("GridsAlwaysOn", "False"));
					GRID_NEIGHBOR_TURNON_TIME = Integer.parseInt(General.getProperty("GridNeighborTurnOnTime", "1"));
					GRID_NEIGHBOR_TURNOFF_TIME = Integer.parseInt(General.getProperty("GridNeighborTurnOffTime", "90"));
					GEODATA = Integer.parseInt(General.getProperty("GeoData", "0"));
					GEODATA_CELLFINDING = Boolean.parseBoolean(General.getProperty("CellPathFinding", "true"));
					FORCE_GEODATA = Boolean.parseBoolean(General.getProperty("ForceGeodata", "True"));
					COORD_SYNCHRONIZE = Integer.parseInt(General.getProperty("CoordSynchronize", "-1"));
					ZONE_TOWN = Integer.parseInt(General.getProperty("ZoneTown", "0"));
					ACTIVATE_POSITION_RECORDER = Boolean.parseBoolean(General.getProperty("ActivatePositionRecorder", "False"));
					DEFAULT_GLOBAL_CHAT = General.getProperty("GlobalChat", "ON");
					DEFAULT_TRADE_CHAT = General.getProperty("TradeChat", "ON");
					ALLOW_WAREHOUSE = Boolean.parseBoolean(General.getProperty("AllowWarehouse", "True"));
					ALLOW_FREIGHT = Boolean.parseBoolean(General.getProperty("AllowFreight", "True"));
					ALLOW_WEAR = Boolean.parseBoolean(General.getProperty("AllowWear", "False"));
					WEAR_DELAY = Integer.parseInt(General.getProperty("WearDelay", "5"));
					WEAR_PRICE = Integer.parseInt(General.getProperty("WearPrice", "10"));
					ALLOW_LOTTERY = Boolean.parseBoolean(General.getProperty("AllowLottery", "True"));
					ALLOW_RACE = Boolean.parseBoolean(General.getProperty("AllowRace", "True"));
					ALLOW_WATER = Boolean.parseBoolean(General.getProperty("AllowWater", "True"));
					ALLOW_RENTPET = Boolean.parseBoolean(General.getProperty("AllowRentPet", "False"));
					ALLOW_DISCARDITEM = Boolean.parseBoolean(General.getProperty("AllowDiscardItem", "True"));
					ALLOWFISHING = Boolean.parseBoolean(General.getProperty("AllowFishing", "True"));
					ALLOW_MANOR = Boolean.parseBoolean(General.getProperty("AllowManor", "True"));
					ALLOW_BOAT = Boolean.parseBoolean(General.getProperty("AllowBoat", "True"));
					ALLOW_CURSED_WEAPONS = Boolean.parseBoolean(General.getProperty("AllowCursedWeapons", "True"));
					ALLOW_NPC_WALKERS = Boolean.parseBoolean(General.getProperty("AllowNpcWalkers", "true"));
					ALLOW_PET_WALKERS = Boolean.parseBoolean(General.getProperty("AllowPetWalkers", "True"));
					SERVER_NEWS = Boolean.parseBoolean(General.getProperty("ShowServerNews", "False"));
					COMMUNITY_TYPE = Integer.parseInt(General.getProperty("CommunityType", "1"));
					BBS_SHOW_PLAYERLIST = Boolean.parseBoolean(General.getProperty("BBSShowPlayerList", "false"));
					BBS_DEFAULT = General.getProperty("BBSDefault", "_bbshome");
					SHOW_LEVEL_COMMUNITYBOARD = Boolean.parseBoolean(General.getProperty("ShowLevelOnCommunityBoard", "False"));
					SHOW_STATUS_COMMUNITYBOARD = Boolean.parseBoolean(General.getProperty("ShowStatusOnCommunityBoard", "True"));
					NAME_PAGE_SIZE_COMMUNITYBOARD = Integer.parseInt(General.getProperty("NamePageSizeOnCommunityBoard", "50"));
					NAME_PER_ROW_COMMUNITYBOARD = Integer.parseInt(General.getProperty("NamePerRowOnCommunityBoard", "5"));
					ALT_OLY_START_TIME = Integer.parseInt(General.getProperty("AltOlyStartTime", "18"));
					ALT_OLY_MIN = Integer.parseInt(General.getProperty("AltOlyMin", "00"));
					ALT_OLY_CPERIOD = Long.parseLong(General.getProperty("AltOlyCPeriod", "21600000"));
					ALT_OLY_BATTLE = Long.parseLong(General.getProperty("AltOlyBattle", "360000"));
					ALT_OLY_WPERIOD = Long.parseLong(General.getProperty("AltOlyWPeriod", "604800000"));
					ALT_OLY_VPERIOD = Long.parseLong(General.getProperty("AltOlyVPeriod", "86400000"));
					ALT_OLY_CLASSED = Integer.parseInt(General.getProperty("AltOlyClassedParticipants", "5"));
					ALT_OLY_NONCLASSED = Integer.parseInt(General.getProperty("AltOlyNonClassedParticipants", "9"));
					ALT_OLY_REG_DISPLAY = Integer.parseInt(General.getProperty("AltOlyRegistrationDisplayNumber", "100"));
					ALT_OLY_BATTLE_REWARD_ITEM = Integer.parseInt(General.getProperty("AltOlyBattleRewItem", "6651"));
					ALT_OLY_CLASSED_RITEM_C = Integer.parseInt(General.getProperty("AltOlyClassedRewItemCount", "50"));
					ALT_OLY_NONCLASSED_RITEM_C = Integer.parseInt(General.getProperty("AltOlyNonClassedRewItemCount", "30"));
					ALT_OLY_COMP_RITEM = Integer.parseInt(General.getProperty("AltOlyCompRewItem", "13722"));
					ALT_OLY_GP_PER_POINT = Integer.parseInt(General.getProperty("AltOlyGPPerPoint", "1000"));
					ALT_OLY_HERO_POINTS = Integer.parseInt(General.getProperty("AltOlyHeroPoints", "180"));
					ALT_OLY_RANK1_POINTS = Integer.parseInt(General.getProperty("AltOlyRank1Points", "120"));
					ALT_OLY_RANK2_POINTS = Integer.parseInt(General.getProperty("AltOlyRank2Points", "80"));
					ALT_OLY_RANK3_POINTS = Integer.parseInt(General.getProperty("AltOlyRank3Points", "55"));
					ALT_OLY_RANK4_POINTS = Integer.parseInt(General.getProperty("AltOlyRank4Points", "35"));
					ALT_OLY_RANK5_POINTS = Integer.parseInt(General.getProperty("AltOlyRank5Points", "20"));
					ALT_OLY_MAX_POINTS = Integer.parseInt(General.getProperty("AltOlyMaxPoints", "10"));
					ALT_OLY_LOG_FIGHTS = Boolean.parseBoolean(General.getProperty("AlyOlyLogFights", "false"));
					ALT_OLY_SHOW_MONTHLY_WINNERS = Boolean.parseBoolean(General.getProperty("AltOlyShowMonthlyWinners", "true"));
					ALT_OLY_ANNOUNCE_GAMES = Boolean.parseBoolean(General.getProperty("AltOlyAnnounceGames", "true"));
					LIST_OLY_RESTRICTED_ITEMS = new FastList<Integer>();
					for (String id : General.getProperty("AltOlyRestrictedItems", "0").split(",")) {
						LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
					}
					ALT_OLY_ENCHANT_LIMIT = Integer.parseInt(General.getProperty("AltOlyEnchantLimit", "-1"));
					ALT_MANOR_REFRESH_TIME = Integer.parseInt(General.getProperty("AltManorRefreshTime", "20"));
					ALT_MANOR_REFRESH_MIN = Integer.parseInt(General.getProperty("AltManorRefreshMin", "00"));
					ALT_MANOR_APPROVE_TIME = Integer.parseInt(General.getProperty("AltManorApproveTime", "6"));
					ALT_MANOR_APPROVE_MIN = Integer.parseInt(General.getProperty("AltManorApproveMin", "00"));
					ALT_MANOR_MAINTENANCE_PERIOD = Integer.parseInt(General.getProperty("AltManorMaintenancePeriod", "360000"));
					ALT_MANOR_SAVE_ALL_ACTIONS = Boolean.parseBoolean(General.getProperty("AltManorSaveAllActions", "false"));
					ALT_MANOR_SAVE_PERIOD_RATE = Integer.parseInt(General.getProperty("AltManorSavePeriodRate", "2"));
					ALT_LOTTERY_PRIZE = Long.parseLong(General.getProperty("AltLotteryPrize", "50000"));
					ALT_LOTTERY_TICKET_PRICE = Long.parseLong(General.getProperty("AltLotteryTicketPrice", "2000"));
					ALT_LOTTERY_5_NUMBER_RATE = Float.parseFloat(General.getProperty("AltLottery5NumberRate", "0.6"));
					ALT_LOTTERY_4_NUMBER_RATE = Float.parseFloat(General.getProperty("AltLottery4NumberRate", "0.2"));
					ALT_LOTTERY_3_NUMBER_RATE = Float.parseFloat(General.getProperty("AltLottery3NumberRate", "0.2"));
					ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = Long.parseLong(General.getProperty("AltLottery2and1NumberPrize", "200"));
					FS_TIME_ATTACK = Integer.parseInt(General.getProperty("TimeOfAttack", "50"));
					FS_TIME_COOLDOWN = Integer.parseInt(General.getProperty("TimeOfCoolDown", "5"));
					FS_TIME_ENTRY = Integer.parseInt(General.getProperty("TimeOfEntry", "3"));
					FS_TIME_WARMUP = Integer.parseInt(General.getProperty("TimeOfWarmUp", "2"));
					FS_PARTY_MEMBER_COUNT = Integer.parseInt(General.getProperty("NumberOfNecessaryPartyMembers", "4"));
					if (FS_TIME_ATTACK <= 0)
						FS_TIME_ATTACK = 50;
					if (FS_TIME_COOLDOWN <= 0)
						FS_TIME_COOLDOWN = 5;
					if (FS_TIME_ENTRY <= 0)
						FS_TIME_ENTRY = 3;
					if (FS_TIME_ENTRY <= 0)
						FS_TIME_ENTRY = 3;
					if (FS_TIME_ENTRY <= 0)
						FS_TIME_ENTRY = 3;
					RIFT_MIN_PARTY_SIZE = Integer.parseInt(General.getProperty("RiftMinPartySize", "5"));
					RIFT_MAX_JUMPS = Integer.parseInt(General.getProperty("MaxRiftJumps", "4"));
					RIFT_SPAWN_DELAY = Integer.parseInt(General.getProperty("RiftSpawnDelay", "10000"));
					RIFT_AUTO_JUMPS_TIME_MIN = Integer.parseInt(General.getProperty("AutoJumpsDelayMin", "480"));
					RIFT_AUTO_JUMPS_TIME_MAX = Integer.parseInt(General.getProperty("AutoJumpsDelayMax", "600"));
					RIFT_BOSS_ROOM_TIME_MUTIPLY = Float.parseFloat(General.getProperty("BossRoomTimeMultiply", "1.5"));
					RIFT_ENTER_COST_RECRUIT = Integer.parseInt(General.getProperty("RecruitCost", "18"));
					RIFT_ENTER_COST_SOLDIER = Integer.parseInt(General.getProperty("SoldierCost", "21"));
					RIFT_ENTER_COST_OFFICER = Integer.parseInt(General.getProperty("OfficerCost", "24"));
					RIFT_ENTER_COST_CAPTAIN = Integer.parseInt(General.getProperty("CaptainCost", "27"));
					RIFT_ENTER_COST_COMMANDER = Integer.parseInt(General.getProperty("CommanderCost", "30"));
					RIFT_ENTER_COST_HERO = Integer.parseInt(General.getProperty("HeroCost", "33"));
					DEFAULT_PUNISH = Integer.parseInt(General.getProperty("DefaultPunish", "2"));
					DEFAULT_PUNISH_PARAM = Integer.parseInt(General.getProperty("DefaultPunishParam", "0"));
					ONLY_GM_ITEMS_FREE = Boolean.parseBoolean(General.getProperty("OnlyGMItemsFree", "True"));
					JAIL_IS_PVP = Boolean.parseBoolean(General.getProperty("JailIsPvp", "True"));
					JAIL_DISABLE_CHAT = Boolean.parseBoolean(General.getProperty("JailDisableChat", "True"));
					SAVE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(General.getProperty("SaveGmSpawnOnCustom", "false"));
					DELETE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(General.getProperty("DeleteGmSpawnOnCustom", "false"));
					CUSTOM_NPC_TABLE = Boolean.valueOf(General.getProperty("CustomNpcTable", "false"));
					CUSTOM_ITEM_TABLES = Boolean.valueOf(General.getProperty("CustomItemTables", "false"));
					CUSTOM_ARMORSETS_TABLE = Boolean.valueOf(General.getProperty("CustomArmorSetsTable", "false"));
					CUSTOM_TELEPORT_TABLE = Boolean.valueOf(General.getProperty("CustomTeleportTable", "false"));
					CUSTOM_DROPLIST_TABLE = Boolean.valueOf(General.getProperty("CustomDroplistTable", "false"));
					CUSTOM_MERCHANT_TABLES = Boolean.valueOf(General.getProperty("CustomMerchantTables", "false"));
					GLOBALCHATLEVELSET = Integer.valueOf(General.getProperty("GlobalChatLevelSet", "15"));
					GLOBALCHATCOSTS = Integer.valueOf(General.getProperty("GlobalChatCosts", "1000"));
					XX4 = Float.parseFloat(General.getProperty("XX4", "0.03"));
					XX8 = Float.parseFloat(General.getProperty("XX8", "0.04"));
					XX12 = Float.parseFloat(General.getProperty("XX12", "0.05"));
					XX24 = Float.parseFloat(General.getProperty("XX24", "0.06"));
					CONSIGNMENTDUTY = Float.parseFloat(General.getProperty("ConsignmentDuty", "0.05"));
					CPAGESIZE = Integer.parseInt(General.getProperty("cpagesize", "20"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + GENERAL_CONFIG_FILE + " File.");
				}

				// 装载防止网络洪水攻击的保护配置
				try {
					L2Properties security = new L2Properties();
					is = new FileInputStream(new File(FLOOD_PROTECTOR_FILE));
					security.load(is);

					loadFloodProtectorConfigs(security);
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + FLOOD_PROTECTOR_FILE);
				}

				// 装载NPC的配置 (if exists)
				try {
					L2Properties NPC = new L2Properties();
					is = new FileInputStream(new File(NPC_CONFIG_FILE));
					NPC.load(is);

					ANNOUNCE_MAMMON_SPAWN = Boolean.parseBoolean(NPC.getProperty("AnnounceMammonSpawn", "False"));
					ALT_MOB_AGRO_IN_PEACEZONE = Boolean.parseBoolean(NPC.getProperty("AltMobAgroInPeaceZone", "True"));

					ALT_GAME_VIEWNPC = Boolean.parseBoolean(NPC.getProperty("AltGameViewNpc", "False"));
					MAX_DRIFT_RANGE = Integer.parseInt(NPC.getProperty("MaxDriftRange", "300"));
					DEEPBLUE_DROP_RULES = Boolean.parseBoolean(NPC.getProperty("UseDeepBlueDropRules", "True"));
					DEEPBLUE_DROP_RULES_RAID = Boolean.parseBoolean(NPC.getProperty("UseDeepBlueDropRulesRaid", "True"));
					SHOW_NPC_LVL = Boolean.parseBoolean(NPC.getProperty("ShowNpcLevel", "False"));

					GUARD_ATTACK_AGGRO_MOB = Boolean.parseBoolean(NPC.getProperty("GuardAttackAggroMob", "False"));
					ALLOW_WYVERN_UPGRADER = Boolean.parseBoolean(NPC.getProperty("AllowWyvernUpgrader", "False"));
					PET_RENT_NPC = NPC.getProperty("ListPetRentNpc", "30827");
					LIST_PET_RENT_NPC = new FastList<Integer>();
					for (String id : PET_RENT_NPC.split(",")) {
						LIST_PET_RENT_NPC.add(Integer.parseInt(id));
					}
					RAID_MINION_RESPAWN_TIMER = Integer.parseInt(NPC.getProperty("RaidMinionRespawnTime", "300000"));
					RAID_DISABLE_CURSE = Boolean.parseBoolean(NPC.getProperty("DisableRaidCurse", "False"));
					INVENTORY_MAXIMUM_PET = Integer.parseInt(NPC.getProperty("MaximumSlotsForPet", "12"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + NPC_CONFIG_FILE + " File.");
				}

				// Load Rates L2Properties file (if exists)
				try {
					L2Properties ratesSettings = new L2Properties();
					is = new FileInputStream(new File(RATES_CONFIG_FILE));
					ratesSettings.load(is);

					RATE_QUESTS_REWARD = Float.parseFloat(ratesSettings.getProperty("RateQuestsReward", "1."));
					RATE_DROP_ADENA = Float.parseFloat(ratesSettings.getProperty("RateDropAdena", "1."));
					RATE_CONSUMABLE_COST = Float.parseFloat(ratesSettings.getProperty("RateConsumableCost", "1."));
					RATE_EXTR_FISH = Float.parseFloat(ratesSettings.getProperty("RateExtractFish", "1."));
					RATE_DROP_ITEMS = Float.parseFloat(ratesSettings.getProperty("RateDropItems", "1."));
					RATE_DROP_ITEMS_BY_RAID = Float.parseFloat(ratesSettings.getProperty("RateRaidDropItems", "1."));
					RATE_DROP_SPOIL = Float.parseFloat(ratesSettings.getProperty("RateDropSpoil", "1."));
					RATE_DROP_MANOR = Integer.parseInt(ratesSettings.getProperty("RateDropManor", "1"));
					RATE_DROP_QUEST = Float.parseFloat(ratesSettings.getProperty("RateDropQuest", "1."));

					RATE_KARMA_EXP_LOST = Float.parseFloat(ratesSettings.getProperty("RateKarmaExpLost", "1."));
					RATE_SIEGE_GUARDS_PRICE = Float.parseFloat(ratesSettings.getProperty("RateSiegeGuardsPrice", "1."));
					RATE_DROP_COMMON_HERBS = Float.parseFloat(ratesSettings.getProperty("RateCommonHerbs", "15."));
					RATE_DROP_MP_HP_HERBS = Float.parseFloat(ratesSettings.getProperty("RateHpMpHerbs", "10."));
					RATE_DROP_GREATER_HERBS = Float.parseFloat(ratesSettings.getProperty("RateGreaterHerbs", "4."));
					RATE_DROP_SUPERIOR_HERBS = Float.parseFloat(ratesSettings.getProperty("RateSuperiorHerbs", "0.8")) * 10;
					RATE_DROP_SPECIAL_HERBS = Float.parseFloat(ratesSettings.getProperty("RateSpecialHerbs", "0.2")) * 10;

					PLAYER_DROP_LIMIT = Integer.parseInt(ratesSettings.getProperty("PlayerDropLimit", "3"));
					PLAYER_RATE_DROP = Integer.parseInt(ratesSettings.getProperty("PlayerRateDrop", "5"));
					PLAYER_RATE_DROP_ITEM = Integer.parseInt(ratesSettings.getProperty("PlayerRateDropItem", "70"));
					PLAYER_RATE_DROP_EQUIP = Integer.parseInt(ratesSettings.getProperty("PlayerRateDropEquip", "25"));
					PLAYER_RATE_DROP_EQUIP_WEAPON = Integer.parseInt(ratesSettings.getProperty("PlayerRateDropEquipWeapon", "5"));
					PET_XP_RATE = Float.parseFloat(ratesSettings.getProperty("PetXpRate", "1."));
					PET_FOOD_RATE = Integer.parseInt(ratesSettings.getProperty("PetFoodRate", "1"));
					SINEATER_XP_RATE = Float.parseFloat(ratesSettings.getProperty("SinEaterXpRate", "1."));
					KARMA_DROP_LIMIT = Integer.parseInt(ratesSettings.getProperty("KarmaDropLimit", "10"));
					KARMA_RATE_DROP = Integer.parseInt(ratesSettings.getProperty("KarmaRateDrop", "70"));
					KARMA_RATE_DROP_ITEM = Integer.parseInt(ratesSettings.getProperty("KarmaRateDropItem", "50"));
					KARMA_RATE_DROP_EQUIP = Integer.parseInt(ratesSettings.getProperty("KarmaRateDropEquip", "40"));
					KARMA_RATE_DROP_EQUIP_WEAPON = Integer.parseInt(ratesSettings.getProperty("KarmaRateDropEquipWeapon", "10"));

					// Initializing table
					PLAYER_XP_PERCENT_LOST = new double[Byte.MAX_VALUE + 1];

					// Default value
					for (int i = 0; i <= Byte.MAX_VALUE; i++)
						PLAYER_XP_PERCENT_LOST[i] = 1.;

					// Now loading into table parsed values
					try {
						String[] values = ratesSettings.getProperty("PlayerXPPercentLost", "0,39-7.0;40,75-4.0;76,76-2.5;77,77-2.0;78,78-1.5").split(";");

						for (String s : values) {
							int min;
							int max;
							double val;

							String[] vals = s.split("-");
							String[] mM = vals[0].split(",");

							min = Integer.parseInt(mM[0]);
							max = Integer.parseInt(mM[1]);
							val = Double.parseDouble(vals[1]);

							for (int i = min; i <= max; i++)
								PLAYER_XP_PERCENT_LOST[i] = val;
						}
					} catch (Exception e) {
						_log.error("Error while loading Player XP percent lost", Config.SERVER_ID, e);
						e.printStackTrace();
					}
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + RATES_CONFIG_FILE + " File.");
				}

				// Load L2JMod L2Properties file (if exists)
				try {
					L2Properties L2JModSettings = new L2Properties();
					is = new FileInputStream(new File(L2JMOD_CONFIG_FILE));
					L2JModSettings.load(is);

					TVT_EVENT_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventEnabled", "false"));
					TVT_EVENT_IN_INSTANCE = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventInInstance", "false"));
					TVT_EVENT_INSTANCE_FILE = L2JModSettings.getProperty("TvTEventInstanceFile", "coliseum.xml");
					TVT_EVENT_INTERVAL = L2JModSettings.getProperty("TvTEventInterval", "20:00").split(",");
					TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(L2JModSettings.getProperty("TvTEventParticipationTime", "3600"));
					TVT_EVENT_RUNNING_TIME = Integer.parseInt(L2JModSettings.getProperty("TvTEventRunningTime", "1800"));
					TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(L2JModSettings.getProperty("TvTEventParticipationNpcId", "0"));

					L2JMOD_ALLOW_WEDDING = Boolean.parseBoolean(L2JModSettings.getProperty("AllowWedding", "False"));
					L2JMOD_WEDDING_PRICE = Integer.parseInt(L2JModSettings.getProperty("WeddingPrice", "250000000"));
					L2JMOD_WEDDING_PUNISH_INFIDELITY = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingPunishInfidelity", "True"));
					L2JMOD_WEDDING_TELEPORT = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingTeleport", "True"));
					L2JMOD_WEDDING_TELEPORT_PRICE = Integer.parseInt(L2JModSettings.getProperty("WeddingTeleportPrice", "50000"));
					L2JMOD_WEDDING_TELEPORT_DURATION = Integer.parseInt(L2JModSettings.getProperty("WeddingTeleportDuration", "60"));
					L2JMOD_WEDDING_SAMESEX = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False"));
					L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
					L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));

					L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingClan", "False"));
					L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
					L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingFreight", "False"));

					if (TVT_EVENT_PARTICIPATION_NPC_ID == 0) {
						TVT_EVENT_ENABLED = false;
						_log.warn("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationNpcId");
					} else {
						String[] propertySplit = L2JModSettings.getProperty("TvTEventParticipationNpcCoordinates", "0,0,0").split(",");
						if (propertySplit.length < 3) {
							TVT_EVENT_ENABLED = false;
							_log.warn("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationNpcCoordinates");
						} else {
							TVT_EVENT_REWARDS = new FastList<int[]>();
							TVT_DOORS_IDS_TO_OPEN = new ArrayList<Integer>();
							TVT_DOORS_IDS_TO_CLOSE = new ArrayList<Integer>();
							TVT_EVENT_PARTICIPATION_NPC_COORDINATES = new int[3];
							TVT_EVENT_TEAM_1_COORDINATES = new int[3];
							TVT_EVENT_TEAM_2_COORDINATES = new int[3];
							TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
							TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
							TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
							TVT_EVENT_MIN_PLAYERS_IN_TEAMS = Integer.parseInt(L2JModSettings.getProperty("TvTEventMinPlayersInTeams", "1"));
							TVT_EVENT_MAX_PLAYERS_IN_TEAMS = Integer.parseInt(L2JModSettings.getProperty("TvTEventMaxPlayersInTeams", "20"));
							TVT_EVENT_MIN_LVL = (byte) Integer.parseInt(L2JModSettings.getProperty("TvTEventMinPlayerLevel", "1"));
							TVT_EVENT_MAX_LVL = (byte) Integer.parseInt(L2JModSettings.getProperty("TvTEventMaxPlayerLevel", "80"));
							TVT_EVENT_RESPAWN_TELEPORT_DELAY = Integer.parseInt(L2JModSettings.getProperty("TvTEventRespawnTeleportDelay", "20"));
							TVT_EVENT_START_LEAVE_TELEPORT_DELAY = Integer.parseInt(L2JModSettings.getProperty("TvTEventStartLeaveTeleportDelay", "20"));
							TVT_EVENT_EFFECTS_REMOVAL = Integer.parseInt(L2JModSettings.getProperty("TvTEventEffectsRemoval", "0"));
							TVT_ALLOW_VOICED_COMMAND = Boolean.parseBoolean(L2JModSettings.getProperty("TvTAllowVoicedInfoCommand", "false"));
							TVT_EVENT_TEAM_1_NAME = L2JModSettings.getProperty("TvTEventTeam1Name", "Team1");
							propertySplit = L2JModSettings.getProperty("TvTEventTeam1Coordinates", "0,0,0").split(",");
							if (propertySplit.length < 3) {
								TVT_EVENT_ENABLED = false;
								_log.warn("TvTEventEngine[Config.load()]: invalid config property -> TvTEventTeam1Coordinates");
							} else {
								TVT_EVENT_TEAM_1_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
								TVT_EVENT_TEAM_1_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
								TVT_EVENT_TEAM_1_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
								TVT_EVENT_TEAM_2_NAME = L2JModSettings.getProperty("TvTEventTeam2Name", "Team2");
								propertySplit = L2JModSettings.getProperty("TvTEventTeam2Coordinates", "0,0,0").split(",");
								if (propertySplit.length < 3) {
									TVT_EVENT_ENABLED = false;
									_log.warn("TvTEventEngine[Config.load()]: invalid config property -> TvTEventTeam2Coordinates");
								} else {
									TVT_EVENT_TEAM_2_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
									TVT_EVENT_TEAM_2_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
									TVT_EVENT_TEAM_2_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
									propertySplit = L2JModSettings.getProperty("TvTEventParticipationFee", "0,0").split(",");
									try {
										TVT_EVENT_PARTICIPATION_FEE[0] = Integer.parseInt(propertySplit[0]);
										TVT_EVENT_PARTICIPATION_FEE[1] = Integer.parseInt(propertySplit[1]);
									} catch (NumberFormatException nfe) {
										if (propertySplit.length > 0)
											_log.warn("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationFee");
									}
									propertySplit = L2JModSettings.getProperty("TvTEventReward", "57,100000").split(";");
									for (String reward : propertySplit) {
										String[] rewardSplit = reward.split(",");
										if (rewardSplit.length != 2)
											_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventReward \"", reward, "\""));
										else {
											try {
												TVT_EVENT_REWARDS.add(new int[] { Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1]) });
											} catch (NumberFormatException nfe) {
												if (!reward.isEmpty())
													_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventReward \"", reward, "\""));
											}
										}
									}

									TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventTargetTeamMembersAllowed", "true"));
									TVT_EVENT_SCROLL_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventScrollsAllowed", "false"));
									TVT_EVENT_POTIONS_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventPotionsAllowed", "false"));
									TVT_EVENT_SUMMON_BY_ITEM_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventSummonByItemAllowed", "false"));
									TVT_REWARD_TEAM_TIE = Boolean.parseBoolean(L2JModSettings.getProperty("TvTRewardTeamTie", "false"));
									propertySplit = L2JModSettings.getProperty("TvTDoorsToOpen", "").split(";");
									for (String door : propertySplit) {
										try {
											TVT_DOORS_IDS_TO_OPEN.add(Integer.parseInt(door));
										} catch (NumberFormatException nfe) {
											if (!door.equals(""))
												_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTDoorsToOpen \"", door, "\""));
										}
									}

									propertySplit = L2JModSettings.getProperty("TvTDoorsToClose", "").split(";");
									for (String door : propertySplit) {
										try {
											TVT_DOORS_IDS_TO_CLOSE.add(Integer.parseInt(door));
										} catch (NumberFormatException nfe) {
											if (!door.isEmpty())
												_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTDoorsToClose \"", door, "\""));
										}
									}

									propertySplit = L2JModSettings.getProperty("TvTEventFighterBuffs", "").split(";");
									if (!propertySplit[0].equals("")) {
										TVT_EVENT_FIGHTER_BUFFS = new FastMap<Integer, Integer>(propertySplit.length);
										for (String skill : propertySplit) {
											String[] skillSplit = skill.split(",");
											if (skillSplit.length != 2)
												_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventFighterBuffs \"", skill, "\""));
											else {
												try {
													TVT_EVENT_FIGHTER_BUFFS.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
												} catch (NumberFormatException nfe) {
													if (!skill.isEmpty())
														_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventFighterBuffs \"", skill, "\""));
												}
											}
										}
									}

									propertySplit = L2JModSettings.getProperty("TvTEventMageBuffs", "").split(";");
									if (!propertySplit[0].equals("")) {
										TVT_EVENT_MAGE_BUFFS = new FastMap<Integer, Integer>(propertySplit.length);
										for (String skill : propertySplit) {
											String[] skillSplit = skill.split(",");
											if (skillSplit.length != 2)
												_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventMageBuffs \"", skill, "\""));
											else {
												try {
													TVT_EVENT_MAGE_BUFFS.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
												} catch (NumberFormatException nfe) {
													if (!skill.isEmpty())
														_log.warn(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventMageBuffs \"", skill, "\""));
												}
											}
										}
									}
								}
							}
						}
					}

					BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
					BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
					BANKING_SYSTEM_ADENA = Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));

					OFFLINE_CRAFT_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineCraftEnable", "false"));
					OFFLINE_SET_NAME_COLOR = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineSetNameColor", "false"));
					OFFLINE_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("OfflineNameColor", "808080"));

					L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(L2JModSettings.getProperty("EnableManaPotionSupport", "false"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + L2JMOD_CONFIG_FILE + " File.");
				}

				// Load PvP L2Properties file (if exists)
				try {
					L2Properties pvpSettings = new L2Properties();
					is = new FileInputStream(new File(PVP_CONFIG_FILE));
					pvpSettings.load(is);

					KARMA_MIN_KARMA = Integer.parseInt(pvpSettings.getProperty("MinKarma", "10"));
					KARMA_MAX_KARMA = Integer.parseInt(pvpSettings.getProperty("MaxKarma", "255"));
					KARMA_XP_DIVIDER = Integer.parseInt(pvpSettings.getProperty("XPDivider", "260"));
					KARMA_LOST_BASE = Integer.parseInt(pvpSettings.getProperty("BaseKarmaLost", "0"));
					KARMA_DROP_GM = Boolean.parseBoolean(pvpSettings.getProperty("CanGMDropEquipment", "false"));
					KARMA_AWARD_PK_KILL = Boolean.parseBoolean(pvpSettings.getProperty("AwardPKKillPVPPoint", "true"));
					KARMA_PK_LIMIT = Integer.parseInt(pvpSettings.getProperty("MinimumPKRequiredToDrop", "5"));
					KARMA_NONDROPPABLE_PET_ITEMS = pvpSettings.getProperty("ListOfPetItems", "2375,3500,3501,3502,4422,4423,4424,4425,6648,6649,6650,9882");
					KARMA_NONDROPPABLE_ITEMS = pvpSettings.getProperty("ListOfNonDroppableItems", "57,1147,425,1146,461,10,2368,7,6,2370,2369,6842,6611,6612,6613,6614,6615,6616,6617,6618,6619,6620,6621,7694,8181,5575,7694,9388,9389,9390");

					String[] array = KARMA_NONDROPPABLE_PET_ITEMS.split(",");
					KARMA_LIST_NONDROPPABLE_PET_ITEMS = new int[array.length];

					for (int i = 0; i < array.length; i++)
						KARMA_LIST_NONDROPPABLE_PET_ITEMS[i] = Integer.parseInt(array[i]);

					array = KARMA_NONDROPPABLE_ITEMS.split(",");
					KARMA_LIST_NONDROPPABLE_ITEMS = new int[array.length];

					for (int i = 0; i < array.length; i++)
						KARMA_LIST_NONDROPPABLE_ITEMS[i] = Integer.parseInt(array[i]);

					// sorting so binarySearch can be used later
					Arrays.sort(KARMA_LIST_NONDROPPABLE_PET_ITEMS);
					Arrays.sort(KARMA_LIST_NONDROPPABLE_ITEMS);

					PVP_NORMAL_TIME = Integer.parseInt(pvpSettings.getProperty("PvPVsNormalTime", "120000"));
					PVP_PVP_TIME = Integer.parseInt(pvpSettings.getProperty("PvPVsPvPTime", "60000"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + PVP_CONFIG_FILE + " File.");
				}
				// try {
				// L2Properties Settings = new L2Properties();
				// is = new FileInputStream(HEXID_FILE);
				// Settings.load(is);
				// SERVER_ID =
				// Integer.parseInt(Settings.getProperty("ServerID"));
				// HEX_ID = new BigInteger(Settings.getProperty("HexID"),
				// 16).toByteArray();
				// } catch (Exception e) {
				// _log.warn("Could not load HexID file (" + HEXID_FILE +
				// "). Hopefully login will give us one.");
				// }
			} finally {
				try {
					is.close();
				} catch (Exception e) {
				}
			}
		} else if (Server.serverMode == Server.MODE_LOGINSERVER) {
			_log.info("loading login config", Config.SERVER_ID);
			InputStream is = null;
			try {
				try {
					L2Properties serverSettings = new L2Properties();
					is = new FileInputStream(new File(LOGIN_CONFIGURATION_FILE));
					serverSettings.load(is);

					MIN_PROTOCOL_REVISION = Integer.parseInt(serverSettings.getProperty("MinProtocolRevision", "40"));
					MAX_PROTOCOL_REVISION = Integer.parseInt(serverSettings.getProperty("MaxProtocolRevision", "40"));

					LOGIN_BIND_ADDRESS = serverSettings.getProperty("LoginserverHostname", "*");
					PORT_LOGIN = Integer.parseInt(serverSettings.getProperty("LoginserverPort", "2106"));
					LOGIN_SOCKET = Boolean.parseBoolean(serverSettings.getProperty("LoginSocket", "false"));

					GAME_SERVER_LOGIN_HOST = serverSettings.getProperty("LoginHostname", "*");
					GAME_SERVER_LOGIN_PORT = Integer.parseInt(serverSettings.getProperty("LoginPort", "9014"));

					DEBUG = Boolean.parseBoolean(serverSettings.getProperty("Debug", "false"));
					PACKET_HANDLER_DEBUG = Boolean.parseBoolean(serverSettings.getProperty("PacketHandlerDebug", "false"));
					DEVELOPER = Boolean.parseBoolean(serverSettings.getProperty("Developer", "false"));
					ASSERT = Boolean.parseBoolean(serverSettings.getProperty("Assert", "false"));

					ACCEPT_NEW_GAMESERVER = Boolean.parseBoolean(serverSettings.getProperty("AcceptNewGameServer", "True"));
					SERVER_ID = REQUEST_ID = Integer.parseInt(serverSettings.getProperty("RequestServerID", "0"));
					ACCEPT_ALTERNATE_ID = Boolean.parseBoolean(serverSettings.getProperty("AcceptAlternateID", "True"));

					LOG_LOGIN_CONTROLLER = Boolean.parseBoolean(serverSettings.getProperty("LogLoginController", "true"));
					LOGIN_TRY_BEFORE_BAN = Integer.parseInt(serverSettings.getProperty("LoginTryBeforeBan", "10"));
					LOGIN_BLOCK_AFTER_BAN = Integer.parseInt(serverSettings.getProperty("LoginBlockAfterBan", "600"));

					DATAPACK_ROOT = new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile();

					INTERNAL_HOSTNAME = serverSettings.getProperty("InternalHostname", "localhost");
					EXTERNAL_HOSTNAME = serverSettings.getProperty("ExternalHostname", "localhost");
					ROUTER_HOSTNAME = serverSettings.getProperty("RouterHostname", "");

					DATABASE_DRIVER = serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
					DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/inndb");
					DATABASE_LOGIN = serverSettings.getProperty("Login", "root");
					DATABASE_PASSWORD = serverSettings.getProperty("Password", "root");
					DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
					DATABASE_MAX_IDLE_TIME = Integer.parseInt(serverSettings.getProperty("MaximumDbIdleTime", "0"));

					SHOW_LICENCE = Boolean.parseBoolean(serverSettings.getProperty("ShowLicence", "true"));
					AUTO_CREATE_ACCOUNTS = Boolean.parseBoolean(serverSettings.getProperty("AutoCreateAccounts", "True"));
					CREATEACCOUNTS = Boolean.parseBoolean(serverSettings.getProperty("CreateAccounts", "True"));
					ACCOUNT_NAME_TEMPLATE = serverSettings.getProperty("AnameTemplate", ".*");
					ACCOUNT_PASSWORD_TEMPLATE = serverSettings.getProperty("ApasswordTemplate", ".*");
					ACCOUNT_PHONENO_TEMPLATE = serverSettings.getProperty("AphoneNoTemplate", ".*");

					FLOOD_PROTECTION_GAMESERVER = Boolean.parseBoolean(serverSettings.getProperty("EnableFloodProtectionGameServer", "True"));
					FAST_CONNECTION_LIMIT_GAMESERVER = Integer.parseInt(serverSettings.getProperty("FastConnectionLimitGameServer", "15"));
					NORMAL_CONNECTION_TIME = Integer.parseInt(serverSettings.getProperty("NormalConnectionTime", "700"));
					FAST_CONNECTION_TIME = Integer.parseInt(serverSettings.getProperty("FastConnectionTime", "350"));
					MAX_CONNECTION_PER_IP = Integer.parseInt(serverSettings.getProperty("MaxConnectionPerIP", "50"));
					LOGIN_TIMEOUT = Integer.parseInt(serverSettings.getProperty("LoginTimeOut", "60000"));
					FLOOD_PROTECTION_CLIENT = Boolean.parseBoolean(serverSettings.getProperty("EnableFloodProtectionClient", "True"));
					FAST_CONNECTION_LIMIT_CLIENT = Integer.parseInt(serverSettings.getProperty("FastConnectionLimitClient", "20"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + LOGIN_CONFIGURATION_FILE + " File.");
				}
				// 装载网络底层配置
				try {
					_log.info("Loading " + NETCORE_CONFIG_FILE.replaceAll("./src/labox/innovation/config/", ""), Config.SERVER_ID);
					L2Properties mmoSettings = new L2Properties();
					is = new FileInputStream(new File(NETCORE_CONFIG_FILE));
					mmoSettings.load(is);
					NETCORE_SELECTOR_SLEEP_TIME = Integer.parseInt(mmoSettings.getProperty("SleepTime", "10"));
					NETCORE_MAX_SEND_PER_PASS = Integer.parseInt(mmoSettings.getProperty("MaxSendPerPass", "10"));
					NETCORE_MAX_READ_PER_PASS = Integer.parseInt(mmoSettings.getProperty("MaxReadPerPass", "10"));
					NETCORE_HELPER_BUFFER_COUNT = Integer.parseInt(mmoSettings.getProperty("HelperBufferCount", "20"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + NETCORE_CONFIG_FILE + " File.");
				}

				// Load Telnet L2Properties file (if exists)
				try {
					L2Properties telnetSettings = new L2Properties();
					is = new FileInputStream(new File(TELNET_FILE));
					telnetSettings.load(is);

					IS_TELNET_ENABLED = Boolean.parseBoolean(telnetSettings.getProperty("EnableTelnet", "false"));
					is.close();
				} catch (Exception e) {
					e.printStackTrace();
					throw new Error("Failed to Load " + TELNET_FILE + " File.");
				}
			} finally {
				try {
					is.close();
				} catch (Exception e) {
				}
			}
		} else {
			_log.error("Could not Load Config: server mode was not set", Config.SERVER_ID, null);
		}
	}

	/**
	 * Set a new value to a game parameter from the admin console.
	 * 
	 * @param pName
	 *            (String) : name of the parameter to change
	 * @param pValue
	 *            (String) : new value of the parameter
	 * @return boolean : true if modification has been made
	 * @link useAdminCommand
	 */
	public static boolean setParameterValue(String pName, String pValue) {
		/* server */
		if (pName.equalsIgnoreCase("MaximumOnlineUsers"))
			MAXIMUM_ONLINE_USERS = Integer.parseInt(pValue);

		/* loginserver */
		else if (pName.equalsIgnoreCase("CreateAccounts"))
			CREATEACCOUNTS = Boolean.parseBoolean(pValue);

		/* rate */
		else if (pName.equalsIgnoreCase("RateQuestsReward"))
			RATE_QUESTS_REWARD = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateDropAdena"))
			RATE_DROP_ADENA = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateConsumableCost"))
			RATE_CONSUMABLE_COST = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateExtractFish"))
			RATE_EXTR_FISH = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateDropItems"))
			RATE_DROP_ITEMS = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateRaidDropItems"))
			RATE_DROP_ITEMS_BY_RAID = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateDropSpoil"))
			RATE_DROP_SPOIL = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateDropManor"))
			RATE_DROP_MANOR = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("RateDropQuest"))
			RATE_DROP_QUEST = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateKarmaExpLost"))
			RATE_KARMA_EXP_LOST = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateSiegeGuardsPrice"))
			RATE_SIEGE_GUARDS_PRICE = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("PlayerDropLimit"))
			PLAYER_DROP_LIMIT = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("PlayerRateDrop"))
			PLAYER_RATE_DROP = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("PlayerRateDropItem"))
			PLAYER_RATE_DROP_ITEM = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("PlayerRateDropEquip"))
			PLAYER_RATE_DROP_EQUIP = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("PlayerRateDropEquipWeapon"))
			PLAYER_RATE_DROP_EQUIP_WEAPON = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("KarmaDropLimit"))
			KARMA_DROP_LIMIT = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("KarmaRateDrop"))
			KARMA_RATE_DROP = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("KarmaRateDropItem"))
			KARMA_RATE_DROP_ITEM = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("KarmaRateDropEquip"))
			KARMA_RATE_DROP_EQUIP = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("KarmaRateDropEquipWeapon"))
			KARMA_RATE_DROP_EQUIP_WEAPON = Integer.parseInt(pValue);

		/* general */
		else if (pName.equalsIgnoreCase("AutoDestroyDroppedItemAfter"))
			AUTODESTROY_ITEM_AFTER = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("DestroyPlayerDroppedItem"))
			DESTROY_DROPPED_PLAYER_ITEM = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("DestroyEquipableItem"))
			DESTROY_EQUIPABLE_PLAYER_ITEM = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("SaveDroppedItem"))
			SAVE_DROPPED_ITEM = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("EmptyDroppedItemTableAfterLoad"))
			EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("SaveDroppedItemInterval"))
			SAVE_DROPPED_ITEM_INTERVAL = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("ClearDroppedItemTable"))
			CLEAR_DROPPED_ITEM_TABLE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("PreciseDropCalculation"))
			PRECISE_DROP_CALCULATION = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("MultipleItemDrop"))
			MULTIPLE_ITEM_DROP = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("CoordSynchronize"))
			COORD_SYNCHRONIZE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("DeleteCharAfterDays"))
			DELETE_DAYS = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("AllowDiscardItem"))
			ALLOW_DISCARDITEM = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowFreight"))
			ALLOW_FREIGHT = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowWarehouse"))
			ALLOW_WAREHOUSE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowWear"))
			ALLOW_WEAR = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("WearDelay"))
			WEAR_DELAY = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("WearPrice"))
			WEAR_PRICE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("AllowWater"))
			ALLOW_WATER = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowRentPet"))
			ALLOW_RENTPET = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowBoat"))
			ALLOW_BOAT = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowCursedWeapons"))
			ALLOW_CURSED_WEAPONS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowManor"))
			ALLOW_MANOR = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowNpcWalkers"))
			ALLOW_NPC_WALKERS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowPetWalkers"))
			ALLOW_PET_WALKERS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("BypassValidation"))
			BYPASS_VALIDATION = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("CommunityType"))
			COMMUNITY_TYPE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("BBSShowPlayerList"))
			BBS_SHOW_PLAYERLIST = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("BBSDefault"))
			BBS_DEFAULT = pValue;
		else if (pName.equalsIgnoreCase("ShowLevelOnCommunityBoard"))
			SHOW_LEVEL_COMMUNITYBOARD = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("ShowStatusOnCommunityBoard"))
			SHOW_STATUS_COMMUNITYBOARD = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("NamePageSizeOnCommunityBoard"))
			NAME_PAGE_SIZE_COMMUNITYBOARD = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("NamePerRowOnCommunityBoard"))
			NAME_PER_ROW_COMMUNITYBOARD = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("ShowServerNews"))
			SERVER_NEWS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("ShowNpcLevel"))
			SHOW_NPC_LVL = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("ForceInventoryUpdate"))
			FORCE_INVENTORY_UPDATE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AutoDeleteInvalidQuestData"))
			AUTODELETE_INVALID_QUEST_DATA = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("ZoneTown"))
			ZONE_TOWN = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("CheckKnownList"))
			CHECK_KNOWN = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("GlobalChat"))
			DEFAULT_GLOBAL_CHAT = pValue;
		else if (pName.equalsIgnoreCase("TradeChat"))
			DEFAULT_TRADE_CHAT = pValue;
		else if (pName.equalsIgnoreCase("GMAdminMenuStyle"))
			GM_ADMIN_MENU_STYLE = pValue;

		/* NPC */
		else if (pName.equalsIgnoreCase("UseDeepBlueDropRules"))
			DEEPBLUE_DROP_RULES = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("GuardAttackAggroMob"))
			GUARD_ATTACK_AGGRO_MOB = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("RaidMinionRespawnTime"))
			RAID_MINION_RESPAWN_TIMER = Integer.parseInt(pValue);

		/* character */
		else if (pName.equalsIgnoreCase("CancelLesserEffect"))
			EFFECT_CANCELING = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("MaximumSlotsForNoDwarf"))
			INVENTORY_MAXIMUM = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("MaximumSlotsForGMPlayer"))
			INVENTORY_MAXIMUM_GM = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("MaximumWarehouseSlotsForNoDwarf"))
			WAREHOUSE_SLOTS_NO_DWARF = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("MaximumWarehouseSlotsForClan"))
			WAREHOUSE_SLOTS_CLAN = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("MaximumFreightSlots"))
			FREIGHT_SLOTS = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("EnchantChanceWeapon"))
			ENCHANT_CHANCE_WEAPON = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("EnchantChanceArmor"))
			ENCHANT_CHANCE_ARMOR = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("EnchantMaxWeapon"))
			ENCHANT_MAX_WEAPON = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("EnchantMaxArmor"))
			ENCHANT_MAX_ARMOR = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("StartingAdena"))
			STARTING_ADENA = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("StartingLevel"))
			STARTING_LEVEL = Byte.parseByte(pValue);
		else if (pName.equalsIgnoreCase("UnstuckInterval"))
			UNSTUCK_INTERVAL = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("PlayerSpawnProtection"))
			PLAYER_SPAWN_PROTECTION = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("RestorePlayerInstance"))
			RESTORE_PLAYER_INSTANCE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowSummonToInstance"))
			ALLOW_SUMMON_TO_INSTANCE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("PartyXpCutoffMethod"))
			PARTY_XP_CUTOFF_METHOD = pValue;
		else if (pName.equalsIgnoreCase("PartyXpCutoffPercent"))
			PARTY_XP_CUTOFF_PERCENT = Double.parseDouble(pValue);
		else if (pName.equalsIgnoreCase("PartyXpCutoffLevel"))
			PARTY_XP_CUTOFF_LEVEL = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("RespawnRestoreHP"))
			RESPAWN_RESTORE_HP = Float.parseFloat(pValue) / 100;
		else if (pName.equalsIgnoreCase("RespawnRestoreMP"))
			RESPAWN_RESTORE_MP = Float.parseFloat(pValue) / 100;
		else if (pName.equalsIgnoreCase("RespawnCost"))
			RESPAWN_COST = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("MaxPvtStoreSellSlotsOther"))
			MAX_PVTSTORESELL_SLOTS_OTHER = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("MaxPvtStoreBuySlotsOther"))
			MAX_PVTSTOREBUY_SLOTS_OTHER = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("StoreSkillCooltime"))
			STORE_SKILL_COOLTIME = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AnnounceMammonSpawn"))
			ANNOUNCE_MAMMON_SPAWN = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltGameSkillLearn"))
			ALT_GAME_SKILL_LEARN = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("RemoveCastleCirclets"))
			REMOVE_CASTLE_CIRCLETS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("MagicFailures"))
			ALT_GAME_MAGICFAILURES = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltMobAgroInPeaceZone"))
			ALT_MOB_AGRO_IN_PEACEZONE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltGameExponentXp"))
			ALT_GAME_EXPONENT_XP = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("AllowClassMasters"))
			ALLOW_CLASS_MASTERS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AllowEntireTree"))
			ALLOW_ENTIRE_TREE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltGameFreights"))
			ALT_GAME_FREIGHTS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltGameFreightPrice"))
			ALT_GAME_FREIGHT_PRICE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("AltPartyRange"))
			ALT_PARTY_RANGE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("AltPartyRange2"))
			ALT_PARTY_RANGE2 = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("AutoLoot"))
			AUTO_LOOT = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AutoLootRaids"))
			AUTO_LOOT_RAIDS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltKarmaPlayerCanBeKilledInPeaceZone"))
			ALT_GAME_KARMA_PLAYER_CAN_BE_KILLED_IN_PEACEZONE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltKarmaPlayerCanShop"))
			ALT_GAME_KARMA_PLAYER_CAN_SHOP = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltKarmaPlayerCanTrade"))
			ALT_GAME_KARMA_PLAYER_CAN_TRADE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltKarmaPlayerCanUseWareHouse"))
			ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltFreeTeleporting"))
			ALT_GAME_FREE_TELEPORT = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AltMembersCanWithdrawFromClanWH"))
			ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH = Boolean.parseBoolean(pValue);

		/* l2jmod */
		else if (pName.equalsIgnoreCase("AllowWedding"))
			L2JMOD_ALLOW_WEDDING = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("WeddingPrice"))
			L2JMOD_WEDDING_PRICE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("WeddingPunishInfidelity"))
			L2JMOD_WEDDING_PUNISH_INFIDELITY = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("WeddingTeleport"))
			L2JMOD_WEDDING_TELEPORT = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("WeddingTeleportPrice"))
			L2JMOD_WEDDING_TELEPORT_PRICE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("WeddingTeleportDuration"))
			L2JMOD_WEDDING_TELEPORT_DURATION = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("WeddingAllowSameSex"))
			L2JMOD_WEDDING_SAMESEX = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("WeddingFormalWear"))
			L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("WeddingDivorceCosts"))
			L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("TvTEventEnabled"))
			TVT_EVENT_ENABLED = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("TvTEventInterval"))
			TVT_EVENT_INTERVAL = pValue.split(",");
		else if (pName.equalsIgnoreCase("TvTEventParticipationTime"))
			TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("TvTEventRunningTime"))
			TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId"))
			TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("EnableWarehouseSortingClan"))
			L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("EnableWarehouseSortingPrivate"))
			L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("EnableWarehouseSortingFreight"))
			L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("EnableManaPotionSupport"))
			L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(pValue);

		/* pvp */
		else if (pName.equalsIgnoreCase("MinKarma"))
			KARMA_MIN_KARMA = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("MaxKarma"))
			KARMA_MAX_KARMA = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("XPDivider"))
			KARMA_XP_DIVIDER = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("BaseKarmaLost"))
			KARMA_LOST_BASE = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("CanGMDropEquipment"))
			KARMA_DROP_GM = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("AwardPKKillPVPPoint"))
			KARMA_AWARD_PK_KILL = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("MinimumPKRequiredToDrop"))
			KARMA_PK_LIMIT = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("PvPVsNormalTime"))
			PVP_NORMAL_TIME = Integer.parseInt(pValue);
		else if (pName.equalsIgnoreCase("PvPVsPvPTime"))
			PVP_PVP_TIME = Integer.parseInt(pValue);
		else
			return false;
		return true;
	}

	private Config() {
	}

	/**
	 * Save hexadecimal ID of the server in the L2Properties file.
	 * 
	 * @param string
	 *            (String) : hexadecimal ID of the server to store
	 * @see HEXID_FILE
	 * @see saveHexid(String string, String fileName)
	 * @link LoginServerThread
	 */
	public static void saveHexid(int serverId, String string) {
		Config.saveHexid(serverId, string, HEXID_FILE);
	}

	/**
	 * Save hexadecimal ID of the server in the L2Properties file.
	 * 
	 * @param hexId
	 *            (String) : hexadecimal ID of the server to store
	 * @param fileName
	 *            (String) : name of the L2Properties file
	 */
	public static void saveHexid(int serverId, String hexId, String fileName) {
		try {
			L2Properties hexSetting = new L2Properties();
			File file = new File(fileName);
			// Create a new empty file only if it doesn't exist
			file.createNewFile();
			OutputStream out = new FileOutputStream(file);
			hexSetting.setProperty("ServerID", String.valueOf(serverId));
			hexSetting.setProperty("HexID", hexId);
			hexSetting.store(out, "the hexID to auth into login");
			out.close();
		} catch (Exception e) {
			_log.warn(StringUtil.concat("Failed to save hex id to ", fileName, " File."));
			e.printStackTrace();
		}
	}

	/**
	 * Loads flood protector configurations.
	 */
	private static void loadFloodProtectorConfigs(final L2Properties properties) {
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_USE_ITEM, "UseItem", "4");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ROLL_DICE, "RollDice", "42");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_FIREWORK, "Firework", "42");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ITEM_PET_SUMMON, "ItemPetSummon", "16");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_HERO_VOICE, "HeroVoice", "100");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_GLOBAL_CHAT, "GlobalChat", "5");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_SUBCLASS, "Subclass", "20");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_DROP_ITEM, "DropItem", "10");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_SERVER_BYPASS, "ServerBypass", "5");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MULTISELL, "MultiSell", "1");
		loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_TRANSACTION, "Transaction", "10");
	}

	/**
	 * Loads single flood protector configuration.
	 * 
	 * @param properties
	 *            L2Properties file reader
	 * @param config
	 *            flood protector configuration instance
	 * @param configString
	 *            flood protector configuration string that determines for which
	 *            flood protector configuration should be read
	 * @param defaultInterval
	 *            default flood protector interval
	 */
	private static void loadFloodProtectorConfig(final L2Properties properties, final FloodProtectorConfig config, final String configString, final String defaultInterval) {
		config.FLOOD_PROTECTION_INTERVAL = Integer.parseInt(properties.getProperty(StringUtil.concat("FloodProtector", configString, "Interval"), defaultInterval));
		config.LOG_FLOODING = Boolean.parseBoolean(properties.getProperty(StringUtil.concat("FloodProtector", configString, "LogFlooding"), "False"));
		config.PUNISHMENT_LIMIT = Integer.parseInt(properties.getProperty(StringUtil.concat("FloodProtector", configString, "PunishmentLimit"), "0"));
		config.PUNISHMENT_TYPE = properties.getProperty(StringUtil.concat("FloodProtector", configString, "PunishmentType"), "none");
		config.PUNISHMENT_TIME = Integer.parseInt(properties.getProperty(StringUtil.concat("FloodProtector", configString, "PunishmentTime"), "0"));
	}
}
